PDA

View Full Version : How can I combine these scripts?


cherylh1972
10-06-2002, 04:56 AM
The scripts I'm referring to are both running on this page... http://www.angelfire.com/me4/biddefordpto/test.html

One image, as of right now, changes images onmouseover. The other image shifts slightly.

How on earth can I get these to work together...or is it even possible?

I am a copy-and-paster so please answer in simple terms, that would be very helpful. Thank you for your time and attention!

Cheryl

whammy
10-06-2002, 05:05 AM
The easiest way is to put the "var" keyword in front of any variables that are used in both scripts, since that will change the scope of the variable to local instead of global.

Also, if you run into problems with that (like different functions using the same variable within the same script that need to be global for some reason), you can just rename any variables that are used in both scripts. :)

P.S. I just realized that my answer wasn't great for a cut-and-paste scripter :D

So you might want to go with the second idea... just look for any variables that are the same in the second script as the first script, and change the variable name *everywhere it's used in the script* :)

ASAAKI
10-06-2002, 10:48 AM
if what u mean is that u want the pictures to both shift and change image, then do this within the img tags:

onmouseover="filter('d840','d922'); this.className='mouseBeOnMe'"
onmouseout="filter('d840','d61'); this.className='mouseBeOffMe'"
onmousedown = "this.className='mouseBeDown'"
onmouseup = "this.className='mouseBeUp'"


--oh btw, i believe i've finally made it to senior member with this post!!:D

cherylh1972
10-06-2002, 11:11 AM
Woohoooo! Thank you Asaaki! Pure brilliance...

Moderator...thank you so much for your suggestion, it was just that Asaaki's was so much easier to understand. ;)

Thank you both for your time, it was very much appreciated!