Revision: 50247
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 17, 2011 06:22 by anagaiyahoocom
Initial Code
var nameSpace = { onload : function() { alert('global'); var page = document.body.id; if(this[page] && typeof this[page].onload === 'function') { this[page].onload(); } }, homepage : { onload : function(){ alert('home'); } }, contact : { onload : function(){ alert('contact'); // onload stuff for contact us page } } }; //Execute global init and specific to page $(document).ready( function(){ nameSpace.onload(); }); The HTML <html> <body id="homepage"> This is home </body> </html>
Initial URL
Initial Description
This will initialize page depending on body tag id. Will load global init code for all pages and specific initialization per page.
Initial Title
Javascript Initialization by page
Initial Tags
Initial Language
JavaScript