View Full Version : Calling TWO OnClick functions

08-10-2005, 07:33 PM
I just finished putting javascript code into my web page, a pretty simple routine that changes the link color on mouseover, changes it again on mouseout, and launches a hyperlink onclick.

I'd like to add something. So that onclick, it plays a sound and also launches the hyperlink.

I've seen some javascript for playing an onclick sound, not sure what's best. but right now my main question is how to write the line so that OnClick does TWO things.

(also - small side question - can the sound be .wav or .aif, or does it have to be .au? what's best? it's a tiny sound - about 1/2 a second long.)


08-10-2005, 10:10 PM

08-10-2005, 10:13 PM
onclick calls any valid javascript code. So you can use a function and/or just separate lines of code with semi-colons. I prefer functions to a ton of embedded code. If I have more than a couple statements, I use functions.


onClick="var x=0;alert(x);"


onClick="doFunction1(); doFunction2();"

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum