slpctrl Posted May 28, 2008 Share Posted May 28, 2008 Dumb question I know, but alright I have a javascript function, how do I call the function when the page loads? Link to comment https://forums.phpfreaks.com/topic/107551-calling-a-function-on-load/ Share on other sites More sharing options...
haku Posted May 28, 2008 Share Posted May 28, 2008 Add this to the end of your javascript: window.onload = function() { // add any code you want to execute on page load. You can add as much as you would like in between the curly braces } Link to comment https://forums.phpfreaks.com/topic/107551-calling-a-function-on-load/#findComment-551360 Share on other sites More sharing options...
calabiyau Posted May 28, 2008 Share Posted May 28, 2008 or.... <body onload="function_name();"> Link to comment https://forums.phpfreaks.com/topic/107551-calling-a-function-on-load/#findComment-552163 Share on other sites More sharing options...
haku Posted May 29, 2008 Share Posted May 29, 2008 That method is outdated. Link to comment https://forums.phpfreaks.com/topic/107551-calling-a-function-on-load/#findComment-552271 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.