Liquid Fire Posted July 3, 2007 Share Posted July 3, 2007 I have heard that i should place javascript code as close to the bottom of the page as I can. sometimes this is not possible(for instacnce i need to do some javascript onload on the body tag but how much of a difference does it really make where i include my javascript code? Quote Link to comment https://forums.phpfreaks.com/topic/58316-placing-javascript-code/ Share on other sites More sharing options...
RichardRotterdam Posted July 3, 2007 Share Posted July 3, 2007 it all depends on what the javascript is supose to do. Mostly i place it in the head. But if the javascript call needs to be done on a certain html section that is located on the bottom you can place it lower. Quote Link to comment https://forums.phpfreaks.com/topic/58316-placing-javascript-code/#findComment-289149 Share on other sites More sharing options...
emehrkay Posted July 4, 2007 Share Posted July 4, 2007 i typically try to place all of my js in the head and try to make sure that my html knows nothing about my js. that mens no event actions tied into my html. so things like onclick="" href="funciton();" etc Quote Link to comment https://forums.phpfreaks.com/topic/58316-placing-javascript-code/#findComment-289296 Share on other sites More sharing options...
roopurt18 Posted July 6, 2007 Share Posted July 6, 2007 If you use the event models correctly in all recent browsers, there is no reason for any Javascript to be present within your HTML. I keep all of my Javascript in .js files or in the head section of the document. Quote Link to comment https://forums.phpfreaks.com/topic/58316-placing-javascript-code/#findComment-291616 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.