<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<input type="text" id="t1" value="" />
<button id="btn">點擊</button>
</body>
</html>
//1、判斷一個整數,屬於哪個范圍:大於0;小於0;等於0
<script type="text/javascript">
btn.onclick=function(){
if(t1.value>0){
alert("你輸入的值大於零");
}else
if(t1.value<0){
alert("你輸入的值小於零");
}else{
alert("你輸入的值等於零");
}
}
</script>
