jackpf Posted April 22, 2009 Share Posted April 22, 2009 Good evening, I am trying to impliment a javascript window.onload handler, as it would be useful to be allowed to call window.onload multiple times. It's pretty simple: function load(f) { window.onload += function() { f; } } But when I add a function with a document.getElementById() or something referencing the DOM tree, it seems to lose value. I get a javascript error saying the element is undefined, when it isn't. Just wondering if anyone knows why this is. Thanks, Jack. Link to comment https://forums.phpfreaks.com/topic/155217-solved-ids-lose-value-in-function/ Share on other sites More sharing options...
jackpf Posted April 22, 2009 Author Share Posted April 22, 2009 How stupid of me - I wasn't using quotes on the function when calling it. *slaps self in face* Link to comment https://forums.phpfreaks.com/topic/155217-solved-ids-lose-value-in-function/#findComment-816583 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.