Jump to content

[SOLVED] ID's Lose Value In Function...


jackpf

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.