|
-
Multiple Dynamic content not working
I'm using multiple dynamic content in a project I'm working on and some of it isn't working. I'm using things from DynamicDrive.com and they say this if you are using more than one code:
"If you have another script on your page that does the same, one of them will not run."
Their solution is this:
"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!"
Ok, I tried this but some items still don't seem to work. Any ideas?
"I think there is a world market for maybe five computers." --Thomas Watson, Chairman of IBM, 1943
-
http://www.wsabstract.com/javatutors...plejava2.shtml
The reason why two working scripts may mysteriously not work when put together is simple- script conflict. You see, any duplication in variable declaration, function name, or event-handler access in two scripts can cause at least one, if not both scripts to become inoperative.
-
A lot depends on exactly what each function is doing.
If one script does something the other depends on, or if both and attempting something that involves the same resources, you're asking for trouble, even if it works "sometimes".
Out of curiosity, try this and see if it gets you anything:
EXAMPLE #4:
SCRIPT 1 & 2: <body onload="dothis();dothat()">
RESOLUTION: <body onload="dothis();setTimeout('dothat()',400)">
Lemme know what you get. It may create a situation where it works "still not at all","sometimes", "most times", or "all fixed". Whichever way, it may help.
~ Nexus
-
Thanks, Nexus, I'll try that
"I think there is a world market for maybe five computers." --Thomas Watson, Chairman of IBM, 1943
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
|
|