Javascript functions -
i have 3 javascript functions:
validateclk()
, validateampm()
, getclks()
and on 2 occurring events, executed follows:
onchange
- executes validateclk()
, validateampm()
onclick
- executes getclks()
(getclks()
returns boolean value)
all 3 functions run correctly, problem is, after getclks()
has finished execution , returns boolean, next function postclocks()
doesn't run. i'm sure code postclocks()
correct well. if don't use return statement getclks()
getclks()
function doesn't work expected.
please :(
<script type='text/javascript'> function validateclk() { .... var clks = clocks.value; if (clks == "") { alert('enter time'); } else { ... } } </script> <script type='...'> function validateampm() { ... var ampm= ap.value; if (ampm=="") { alert('enter or pm'); } } </script> <script type='text/...'> function getclks() { var clks= clock.value; var ampm= ap.value; if (clks==" && ampm="") { alert('enter time , am/pm'); return false; } else { ... } return true; } </script> <... onchange="validateclk(); validateampm();" /> <... button label="submit" onclick="return getclks(); postclocks(); return false;" />
have of custom functions return boolean
change onclick
event this:
onclick="if(!getclks() || !postclocks()) return false;"
assuming don't want continue if invalid
Comments
Post a Comment