d_barszczak Posted June 5, 2008 Share Posted June 5, 2008 The following line of code works fine when in the same html document but won't work from a seperate .js file. document.getElementById('menubar').innerHTML = "<p>Test Message</p>"; Any Ideas? Link to comment https://forums.phpfreaks.com/topic/108911-js-file-problems/ Share on other sites More sharing options...
hansford Posted June 5, 2008 Share Posted June 5, 2008 yeah place it at the bottom of the page before </html> otherwise the elements arent fully loaded and you'll get errors Link to comment https://forums.phpfreaks.com/topic/108911-js-file-problems/#findComment-558777 Share on other sites More sharing options...
haku Posted June 5, 2008 Share Posted June 5, 2008 Or else make sure you add it to window.onload so that it loads after the window has loaded. Link to comment https://forums.phpfreaks.com/topic/108911-js-file-problems/#findComment-558797 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.