我想检查输入的值是否为 10(如果值为 10,我希望将结果发送到“send.php”)。我究竟做错了什么?
<?php $cod1=rand(0, 10);
$cod2=10-$cod1; ?>
<form action='send.php' method='post' onsubmit='f1(this)'>
Please enter the value of <br> <?php echo $cod1 ?> + <?php echo $cod2 ?> in the following box
<input type="text" name="xrezultat" id="xrezultat" class="box" size="32"/>
<input name="Submit1" type="submit" class="butt" value="Trimiteti">
<input name="Submit2" type="reset" class="butt" value="Stergeti ">
</form>
<Script>
function f1(input)
{
if(document.getElementById("xrezultat").value!=10)
aux==false;
if (aux == true)
{
return true;
}
else
{
alert ( "Please enter the correct value" );
return false;
}
}
</script>