lcscne
10-03-2003, 04:17 PM
Is it possible to run more than one function per event handler? Say:
onsubmit="return fun1(); fun2(); return fun3()"
Thanks
onsubmit="return fun1(); fun2(); return fun3()"
Thanks
|
Click to See Complete Forum and Search --> : run more than one funcion onsubmit lcscne 10-03-2003, 04:17 PM Is it possible to run more than one function per event handler? Say: onsubmit="return fun1(); fun2(); return fun3()" Thanks AdamBrill 10-03-2003, 04:25 PM Yes, what you have there would work. However, if the first function returns false, the rest of them probably would not run... Charles 10-03-2003, 04:59 PM Originally posted by lcscne onsubmit="return fun1(); fun2(); return fun3()"It doesn't matter what value fun1() returns, the others will not run. The value of the "onsubmit" attribute is simply a JavaScript function, what you would pit inside the curley braces using the function () {} syntax. At a return the function stops running and returns some value. lcscne 10-03-2003, 05:59 PM Charles my man, You seem to have all the answers here. Can I create another function which runs all 3 checking the return values of each then return a single value to onSubmit? Say for instance I didn't want to submit if any returned false, how can I run a function within another function? Thanks man. Charles 10-03-2003, 06:38 PM onsubmit="var b = true; if (!func1()) b = false; if (!func2()) b = false; if (!func3()) b = false; return b" lcscne 10-03-2003, 06:48 PM you rock man, thanks much webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |