<html lang="en">
<head>
<title>奇偶数</title>
</head>
<body>
<input type=text>
<input type=button value="判断" onclick="chk(value)">
<p id="demo"></p>
<script>
function chk(num) {
var inputs = document.getElementsByTagName('input')[0]
var value = inputs.value
num = value
console.log(num)
alert((num % 2 == 0) ? "偶数" : "奇数") //判断是否能整除2
}
</script>
</body>
</html>
1.首先,js在电脑中找到eclipse,并打开eclipse2.打开eclipse之后, 新建一个类,输入类名之后,点击“Finish”
3.点击“Finish”之后,写好注释