/    Sign up×
Community /Pin to ProfileBookmark

Adding Javascript to menu’s

I have a 5 page website, and I want to add JS to my menu. Is it to late, and how do I go about it. I’m not looking for anything fancy.

Thanks in advance.?

[CODE]<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN”
“http://www.w3.org/TR/html4/strict.dtd”>
<html lang=”en”>
<head>

<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″>
<meta name=”language” content=”english”>
<meta http-equiv=”Content-Style-Type” content=”text/css”>

<title>Welcome to my Home Page</title>

<link rel=”stylesheet” type=”text/css” href=”css/main.css”>

</head>
<body>

<div id=”container”>

<p><img id=”banner” src=”images/banner.gif” alt=”banner”></p><hr color=”#FF0000″></p>
<ul id=”nav”>
<li><a href=”index.html”>Home</a></li>
<li><a href=”scripts_developed.html”>Scripts Developed</a></li>
<li><a href=”best_practices.html”>Best practices for JavaScript coding</a></li>
<li><a href=”ajax.html”>AJAX</a></li>
<li><a href=”JavaScript_frustrations.html”>JavaScript frustrations &amp; Javascript Game</a></li>
<li></li>
</ul>

<div id=”content”></div>

</div>
<table width=”1050″ border=”0″ align=”center”>
<tr>
<td align=”center”><p><img src=”images/logo1.gif” width=”300″ height=”300″ hspace=”30″><img src=”images/logo3.gif” width=”300″ height=”300″><img src=”images/logo2.gif” width=”300″ height=”300″></p>
<p><img src=”images/logo4.gif” width=”300″ height=”300″ hspace=”30″><img src=”images/logo5.gif” width=”300″ height=”300″><img src=”images/logo6.gif” width=”300″ height=”300″></p></td>
</tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</html>[/CODE]

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@JunkMaleDec 22.2011 — Depends on what you want to do.

In most cases CSS menus will or can do the job of Javascript. If you type in to the search engine of your choice the search term

CSS Menus

and see what pops up, you might find it easier than using JavaScript unless you need to do something specific like on some sites that "Animate" menus with fancy roll downs or slides and fades that would need to be processed by JS. You could use a combination of both CSS and JS.

As you have not stated what it is that your trying to do, people can not help you.

If you want to add JS to a page, you can find this line [CODE]<link rel="stylesheet" type="text/css" href="css/main.css">[/CODE] and insert your JS here as a <script></script> tags in the head or as an external file [CODE]<script src="path/to/file.js" type="text/javascript"></script> [/CODE]

If you load in a remote file, the [CODE]<script src="path/to/file.js" type="text/javascript">/* CAN NOT HAVE ANYTHING HERE !!! */</script>[/CODE] if you want to add more JS, you either add [CODE]<script type="text/javascript">
// Your code here
</script>[/CODE]
or you add it to the existing js file loaded separately or define another <script src tag to load that file.

Anyway, that should help you with getting JS in to your page, it won't help your scripting as you didn't show what it was you wanted inserting.
Copy linkTweet thisAlerts:
@MaxxxxauthorDec 22.2011 — Thank you very much, this is helpful. it's for my final Assignment and i have to add JS in some form to my links. thanks ?
×

Success!

Help @Maxxxx spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...