PDA

View Full Version : Who to turn to? Multiple scripts/same page



rwesley_rn
02-09-2005, 12:33 AM
DD Fade-in slideshow

http://www.dynamicdrive.com/dynamicindex14/fadeinslideshow.htm

Which way to go??? I know a lot of ppl are using multiple java scripts on the same page and that is the nature of my question (using the same script multiple times on the same page). However my question isn't welcomed here (I think) or in the dedicated Java forum. So more importantly, where can users go to find out this sort of information or hire an individual for some one time assistance/advice?

karine
02-09-2005, 01:32 AM
I had this same problem. I have 3 scripts on two pages. A friend sent me the following links that helped to understand what was going on: 95% of problems relate to event handlers...
http://www.javascriptkit.com/javatutors/eventaction4.shtml
and this:
http://www.wsabstract.com/javatutors/multiplejava3.shtml

The usual solution is
1. to fix the <BODY> tag and add onLoads separated by commas
2. to either remove the document.write="whatever" line from the script OR to comment out with curvy parentheses the function whose name you put into the <BODY> tag.
Check out the <BODY> tags and the commented out functions on these two pages:
bossradio.net/index.html
bossradio.net/listening/index.html
I had to get a techie friend to help me, but I think I can do it from here on out having these two page samples. good luck,

Karine

rwesley_rn
02-09-2005, 02:15 AM
Dear Karine;

I actually had that very same article printed out when I was trying to get this to work (I found it last week). But the catch is that the article identifies two different scripts working together and (unfortunately) does not address the same script repeating itself on the same page. Thanks for such a prompt reply and sincere intention (nice page links!) Thanks again.

Roger

speedracer
02-10-2005, 09:16 AM
you're in luck. i have a page with 3 of those script. i have uploaded to a server: http://66.33.60.221/~a206/dynamicdrive/3faderslideshow.htm

you would have to rename each of the varibles and functions to each script so that it wouldn't interfere with each other and combine all the onload event in the head section. the above is a poor example, but that's is how you would do it w/o writing any codes. there are far better written code that you can use mutiple times available.

rwesley_rn
02-11-2005, 04:02 AM
Your a life saver. I really appreciate your reply/script. That is EXACTLY the concept that I was looking for!!! I spoke with ppl from Kasamba, DevShed, CodingForums.com and nobody (I mean NOBODY) could tell me if this would work.

I had experts and professionals from all over the place tell me the closest I could come to duplicating this effect was with flash, C+ programming or mostly the new limited IE transition effects (HTC); example at http://www.palmleafphotography.com/plp2004/default.htm

Also want to encourage ppl to ask and rely on peers as I have learned from this in a big way. I had ppl offering to help for $200 on the LOW end to one guy from CA requesting $3750 :eek: (and then along comes speedracer...)

Sincere thanks again!

rwesley_rn
02-11-2005, 04:15 AM
Also want to thank Karine for the additional resource... check out http://www.dhtmlshock.com/scrollers/NewsScroller/default.asp for additional info and examples to go with speedracer's solution!

:D Thanks Karine!!!

Minos
02-11-2005, 06:45 AM
Also, for the sake of reducing the amount of redundant code, I have been staring at this one as well...I'll let you know when I finish it. Basically, I trying to combine those three scripts (because they are the same thing!), into one.

speedracer
02-11-2005, 07:24 AM
here's a good site with mutiple image slide show:
http://dyn-web.com/javascript/rotate-img/

waigy
06-04-2005, 04:51 PM
you're in luck. i have a page with 3 of those script. i have uploaded to a server: http://66.33.60.221/~a206/dynamicdrive/3faderslideshow.htm

you would have to rename each of the varibles and functions to each script so that it wouldn't interfere with each other and combine all the onload event in the head section. the above is a poor example, but that's is how you would do it w/o writing any codes. there are far better written code that you can use mutiple times available.

Hey Man

Im trying to do the same thing with 3 animations, but I want them underneath each other with text inbetween (not in a table).
I can only get one animation working when I try this, but Im just a beginner.
Can one of you experts check out the code on my page and see whats wrong?

www.craighood.com then got to the queens view page.

Also, Ive just got the rollovers on my main menu page working, but they take about a second to change, is this just caused by the size of the rollover jpg?

Cheers Man

Waigy

CrUeL
07-08-2005, 09:59 AM
you're in luck. i have a page with 3 of those script. i have uploaded to a server: http://66.33.60.221/~a206/dynamicdrive/3faderslideshow.htm

you would have to rename each of the varibles and functions to each script so that it wouldn't interfere with each other and combine all the onload event in the head section. the above is a poor example, but that's is how you would do it w/o writing any codes. there are far better written code that you can use mutiple times available.

did a search and found your post. :D
any idea why once i set a link to the images, it didn't show up?

example:
fadeimages[0]=["images/main_03_2.gif", "showroom.htm", ""]

jscheuer1
07-08-2005, 10:43 AM
Might as well throw my two cents in, if a script is working and you add something to it and it breaks, 99% of the time, you did something wrong. I can't tell what it might be from such a small snippet but, is it supposed to have those empty quotes, are they for an optional target or something, if not, get rid of them. Otherwise, I have no idea what happened. Now on to the larger question of this thread -

.

Aside from the tutorial above which usually is the solution when the problem is two different scripts, you may need to consult:

http://www.howtocreate.co.uk/tutorials/index.php?tut=0&part=0&TOshow=allshow#refcon

Which explains how two scripts on the same page may not use the same set of variable names, id names, etc. This is especially important if the problem is two copies of the same script on a page.

One other approach that works in both situations is to put one script in a borderless iframe. It will look like it is on the same page but, since it really is on a separate page, conflicts are no longer an issue.

CrUeL
07-08-2005, 11:11 AM
thanks alot jscheuer1 ... completely forgotten about using iframes to solve this problem...

well it's working fine now with iframes! thanks!

Tam
02-16-2006, 01:05 AM
SpeedRacer,

Was hoping you may be able to assist me. I am at a stand still with a client site and understand through searching the threads that you are the person to talk to when it comes to multiple scripts on one page. Is it at all possible that you could help me out? I am trying to run the HV Menu and the conveyor belt slideshow together. I also have another site that I will have the HV Menu script running along with one of the fader scripts. So your help would be so much appreciated. Here is my testing location for the page that I am having trouble with www.kleaninghouse.com (http://www.kleaninghouse.com). I will await your response.

Thanks Tam

jillo
05-03-2006, 11:24 PM
I just fixed my problem, didn't have any "onload" in the code, but the scripts I had downloaded from Dynamic had the same variable names and function names....so they were fighing with each other. They both lived in separate .js files. I renamed all the variables and the functions, and now the code works just fine.

Appreciate the help this forum brings.
Jill

djr33
05-04-2006, 01:53 AM
Basic rules for two scripts on the same page:

1. If you have two unrelated scripts, just go through and be sure that all variable names and references to them with commands like onClick, etc. are unique.
2. If you have two of the same instance of the same script, do the same, but you'll have more work because you need to be sure that they have ALL unique parts (with maybe some exceptions if a function can be only used once and works for both). It's like above, but you know there are overlapping parts to begin.
3. If you have two scripts you wish to be related or work together, this is a much more complex problem that will vary by each script. There's no real set of rules here... just use some logic and see what works.
These methods aren't foolproof and won't work all the time.

Hope this is helpful.

by the way, it's not that we don't want to help you, just that it is very confusing to try to make two scripts work together.
Sometimes, even if they don't seem to be related, overlapping resources can be in conflict and it can be weird.


One other approach that works in both situations is to put one script in a borderless iframe. It will look like it is on the same page but, since it really is on a separate page, conflicts are no longer an issue.This is a good workaround. Frames would work too, IF they work for your layout.