GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Javascrip help (https://gfy.com/showthread.php?t=105307)

harvey 02-05-2003 08:21 PM

Javascrip help
 
I have 2 javascript codes (one to preload images and one pop-up) that use "BODY onLoad", but I can make to work only one of them at a time, what can I do to make it work?

mike503 02-05-2003 08:24 PM

look for one that returns false, it might be messing it up. or make a new function

function pops_suck() {
popup_function();
other_function();
return true;
}

and call that single function from the body onload... should work.

jimmyf 02-05-2003 08:25 PM

Adding more than one JavaScript to a page

The solution

The way to go about solving this conflict is simple,
though not quite the same to explain. Essentially, what
you want is to end up with only ONE delta for both scripts,
with that delta calling the two scripts. Let's list some
possible scenarios now, and their resolutions:

EXAMPLE #1:
SCRIPT 1: <body onload="dothis()">
SCRIPT 2: <body onload="dothat()">
RESOLUTION: <body onload="dothis();dothat()">

EXAMPLE #2:
SCRIPT 1: <body onload="dothis()">
SCRIPT 2: window.onload=dothat()
RESOLUTION: <body onload="dothis();dothat()">

EXAMPLE #3:
SCRIPT 1: window.onload=dothis
SCRIPT 2: window.onload=dothat
RESOLUTION: <body onload="dothis();dothat()">

As you can see, regardless of whether the two scripts contain
"delta" or "beta", the resolution is the same- remove BOTH lines,
and call the scripts directly within the <body> tag, each separated
by a semicolon. If you wish to combine three scripts, the procedure
is the exact same.

By using the above technique, both scripts are called and executed,
as opposed to just one- or neither. In other words, conflict avoided!
Check out http://www.javascriptkit.com/javatut...taction4.shtml
for some additional information on resolving script conflicts.

By the why I got above by doing a search.

harvey 02-05-2003 10:14 PM

thanx guys, problem solved :thumbsup


All times are GMT -7. The time now is 05:07 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123