Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript wont load on forum, but works fine by itself on html doc.

Status
Not open for further replies.

stevef22

Technical User
Sep 20, 2005
83
US
I have a display page peel effect done in javascript / flash.

What is the "safe" method to call when it is placed on webpage with many other scripts.

It loads fine by itself, link

But when I put the same line of code inside my phpbb
template file it will not load it.

I think its beacuse my BBS has scripts loading and conflicting with the page peel effect.

What is better method to call my external javascript file and load correctly?
 
I think its beacuse my BBS has scripts loading and conflicting with the page peel effect.
That sounds about right. I would go through the BBS scripts you are running and look for the code that is responsible for attaching to the onload event... and then rewrite them to append (rather than overwrite) the script loading function to the onload event.

Here is the kind of code you will need to adapt:
Code:
if (typeof window.onload == 'function') {
	var _tempOnload = window.onload;
	window.onload = function() {
		_tempOnload();
		// do load function
	}
} else {
	window.onload = function () {
		// do load code
	};
}

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top