"Barkster" <bd***@hotmail.com> writes:
I have two functions on buttons onclick, they work but if the first
fails the second still runs.
Yes, nothing in the code to prevent that.
How can I prevent this?
Do you also want the click event to be cancelled if either returns
false?
onclick="if (Function1() !== false) { Function2(); }"
or less strict about the return value of Function1 (the above
counts only exactly the value "false" as preventing Function2):
onclick="return Function1() && Function2();"
It also cancels the click event if Function1 returns false or
it returns a true-equivalent value and Function2 returns false.
/L
--
Lasse Reichstein Nielsen -
lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'