PDA

View Full Version : button with mutiple onclicks



mindbenderz
12-10-2008, 02:50 PM
I have a button on 1 of my site pages that I wish to have multiple onclick actions. It is a bid button for an auction type page. I want to be able to click it and not only have it place the bid, but play a sound. the sound plays fine on a seperate standalone button, but I need to have both functions work on the same button. This is what the code for the button looks like with just the bid function.


<input type="button" name="bid" id="bid" value="Bid Now" onclick="javascript:return start_bid();" />

and this is the sound button by itself


<input type="button" name="sound" id="sound" value="play sound" onclick="playSound(0);" />

I have tried


<input type="button" name="bid" id="bid" value="Bid Now" onclick="javascript:return start_bid();playSound(0);" />

but it didnt produce the sound when I clicked the button. thanks for your help

vwphillips
12-10-2008, 05:00 PM
<input type="button" name="bid" id="bid" value="Bid Now" onclick="start_bid();playSound(0);" />


should work. I do not know what the return is for in your statement.

if it is necessary


<input type="button" name="bid" id="bid" value="Bid Now" onclick="playSound(0);return start_bid();" />

mindbenderz
12-10-2008, 05:21 PM
actually, while I was going over it a few times, what I actually need is not for the button to make the sound, but the updating of the current bid.

so if several users are on the auction, since the bid updates in realtime while they all watch, every time the current bid is updated they all hear the sound. otherwise, attached to the button, only thr user clicking the button would even hear it.

is there such a thing as an onupdate function?? thanks again