where should I place the javascript function definations?
I put fade in slide show javascript function defination after <head> before <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<head>
<script type="text/javascript">
...
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
When I run the page in firefox. It makes the browser revisit the server again. (I use the php code to record the click, one click to this page record two clicks) But if I run it in Internet Explorer, it is fine.
My guess is that firefox default set up as display while downloading, internet explorer set up as display after full download.
But I cannot explain why javascript put before meta tags caused the firefox browser visist the server twice.
But if I put the javascript block after <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> , it is fine. It will not revisit the server.
What is the rule here about where to place the javascript block?
I understand that put javascript after meta tags is good practice. But I want to know why if javascript put before meta tags, it makes firefox visist the server twice. Now, it only messed up my stats record, but itt could cause logic error in the other programming issues, such as sumbit the online orders twice etc.
I searched around, but no authentic answer about why put javascript block before <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> cause this error.
Thanks!



Reply With Quote


Bookmarks