halcali
05-14-2004, 12:40 AM
i read online that seperating both function with a ';' would work... but the following does not....
<input type="submit" value="SUBMIT RESULTS" onClick="return verify();return verify2();">
basically with the above whichever function is first gets called, the other gets ignored. this is the code that it is calling (its a pop up alert to make sure all questions are answered)....
<script>
<!--
answers=new Array(48);
for (i=1; i<=48; i++) {answers[i]=0;}
function verify()
{
var i, found=0, error="";
for (i=1; i<=48; i++)
{
if (answers[i]==0)
{
if (error>"") {error=error+", ";}
error=error+i;
found++;
}
}
if (found==1) {alert("You missed question #"+error+"!"); return false;}
if (found>1) {alert("You missed "+found+" questions: "+error+"!"); return false;}
}
//-->
</script>
<script>
<!--
answersB=new Array(48);
for (i=1; i<=48; i++) {answersB[i]=0;}
function verify2()
{
var i, found=0, error="";
for (i=1; i<=48; i++)
{
if (answersB[i]==0)
{
if (error>"") {error=error+", ";}
error=error+i;
found++;
}
}
if (found==1) {alert("You missed question #"+error+"!"); return false;}
if (found>1) {alert("You missed "+found+" questions: "+error+"!"); return false;}
}
//-->
</script>
any ideas on how to get both functions to get called when pressing submit or alternatively integrating both functions into one function?
<input type="submit" value="SUBMIT RESULTS" onClick="return verify();return verify2();">
basically with the above whichever function is first gets called, the other gets ignored. this is the code that it is calling (its a pop up alert to make sure all questions are answered)....
<script>
<!--
answers=new Array(48);
for (i=1; i<=48; i++) {answers[i]=0;}
function verify()
{
var i, found=0, error="";
for (i=1; i<=48; i++)
{
if (answers[i]==0)
{
if (error>"") {error=error+", ";}
error=error+i;
found++;
}
}
if (found==1) {alert("You missed question #"+error+"!"); return false;}
if (found>1) {alert("You missed "+found+" questions: "+error+"!"); return false;}
}
//-->
</script>
<script>
<!--
answersB=new Array(48);
for (i=1; i<=48; i++) {answersB[i]=0;}
function verify2()
{
var i, found=0, error="";
for (i=1; i<=48; i++)
{
if (answersB[i]==0)
{
if (error>"") {error=error+", ";}
error=error+i;
found++;
}
}
if (found==1) {alert("You missed question #"+error+"!"); return false;}
if (found>1) {alert("You missed "+found+" questions: "+error+"!"); return false;}
}
//-->
</script>
any ideas on how to get both functions to get called when pressing submit or alternatively integrating both functions into one function?