Hi JK,
IMO, you should try to put as much of your JavaScript in the <head> section of the page. That way, it's easy to maintain because all your code is packed together. Personally, I put
all my JavaScript that goes in functions or in linked files in the <head> section, and only put JavaScript that needs to run immediately in the middle of the page. E.G.:
Code:
<html>
<head>
<script type="text/javascript" language="JavaScript">
function SayWhat(whatToSay)
{
alert(whatToSay);
}
</script>
</head>
<body onload="SayWhat('Pape has completed loading');">
... Page Here
<script type="text/javascript" language="JavaScript">
SayWhat('In the Middle of the Page');
</script>
... Rest of Page Here
</body>
</html>
With this example, the "inline" script will run as soon as that part has finished loading (in the middle of the page), while all other code is placed in the <head> section.
So, IMO, a handler for the onclick of a checkbox should be placed in the <head> block because it's a separate function that can be called multiple times, and does not depend on being at a specific location in the page.
Does this help?
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.