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? Quote 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 Quote 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. Quote Link to comment https://forums.phpfreaks.com/topic/108911-js-file-problems/#findComment-558797 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.