View Single Post
  #4  
Old 11-22-2007, 04:59 AM
Jeremy's Avatar
Jeremy Jeremy is offline
Brigadier General
 
Join Date: Apr 2006
Location: Canada
Posts: 1,548
Send a message via MSN to Jeremy Send a message via Skype™ to Jeremy
Default Re: Hover Ads fall in behind.

JavaScript code can be inserted either in the head of the document (between the <head> and </head> tags) or in the body (between the <body> and </body> tags). It is a good idea to always place JavaScript code in the head if you can.

<html><head><title>My Page</title>
<script language="javascript" type="text/javascript">
function myFunction() {
alert('Hello world');
}
</script>
</head>
<body>
<a href="javascript:myFunction();">Click here</a>
</body>
</html>

Since the head loads before the body, placing code in the head ensures that it is available when needed. For example, the following code will work once the page has completely loaded.

<html><head><title>My Page</title>
</head>
<body>
<a href="javascript:myFunction();">Click here</a>
<script language="javascript" type="text/javascript">
function myFunction() {
alert('Hello world');
}
</script>
</body>
</html>
__________________
Best Regards,
Jeremy
Reply With Quote