• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Java script people, can you help me decode this bit of code?

Maximus96

Diamond Member
document.write("<div id=_p_></div>");window.onload=function(){try{var u=document.body.getAttribute("unload");if(u)eval(u);}catch(e){}};

It looks like every time I go on the net with firefox at work it will first go to 1.2.3.0

So I was wondering what that was and typed that into the address bar. That's when I see the code above. It looks to me its gathering my info and writing it to a file. Can somebody tell me exactly what info its gathering?

Thanks
 
Two functions here:

document.write("<div id=_p_></div>") does nothing. Writes an empty <div> tag.

window.onload=function(){try{var u=document.body.getAttribute("unload");if(u)eval(u);}catch(e){}};

Retrieves the contents of the unload attribute from the <body> tag in your HTML. If there is an unload function defined, that function is then executed. The code is executed when the window is loaded.
 
Originally posted by: MrChad
Two functions here:

document.write("<div id=_p_></div>") does nothing. Writes an empty <div> tag.

window.onload=function(){try{var u=document.body.getAttribute("unload");if(u)eval(u);}catch(e){}};

Retrieves the contents of the unload attribute from the <body> tag in your HTML. If there is an unload function defined, that function is then executed. The code is executed when the window is loaded.

And then we fire ze missiles.
 
Originally posted by: MrChad
Two functions here:

document.write("<div id=_p_></div>") does nothing. Writes an empty <div> tag.

window.onload=function(){try{var u=document.body.getAttribute("unload");if(u)eval(u);}catch(e){}};

Retrieves the contents of the unload attribute from the <body> tag in your HTML. If there is an unload function defined, that function is then executed. The code is executed when the window is loaded.

Thanks for your help. But I still don't understand what exactly does it do? What is the unload attribute?
 
Originally posted by: Beev
The residents of AT fought long and hard for a programming forum!

Yes they/we did!

And IMO idle topics hang out on page one way too long for a board with as many techie members as this one.

 
Originally posted by: Maximus96
Originally posted by: MrChad
Two functions here:

document.write("<div id=_p_></div>") does nothing. Writes an empty <div> tag.

window.onload=function(){try{var u=document.body.getAttribute("unload");if(u)eval(u);}catch(e){}};

Retrieves the contents of the unload attribute from the <body> tag in your HTML. If there is an unload function defined, that function is then executed. The code is executed when the window is loaded.

Thanks for your help. But I still don't understand what exactly does it do? What is the unload attribute?
If assigned a value, it names a function/procedure to call when the page body is unloaded from the browser window. What actually happens depends on what the function was written to do.
 
Back
Top