81,095
社区成员
发帖
与我相关
我的任务
分享
<script type="text/javascript">
function getnum(){
var ran1=document.getElementById("ran1").value;
var ran2=document.getElementById("ran2").value;
var ran3=document.getElementById("ran3").value;
alert(ran1);
alert(ran2);
alert(ran3);
if((ran1+ran2)==ran3){alert("true");}
else alert("false");
}
</script>
<form method="post" action="">
<input type="submit" value="验证" onclick="getnum()">
<input type="text" name="ran1" id="ran1" value="<%=(int) (Math.random() * 10)%>"/>+
<input type="text" id="ran2" value="<%=(int) (Math.random() * 10)%>"/>=
<input type="text" id="ran3" value=""/>
</form>