function fun(){
var score=document.getElementById("a").value;
if (score%2 !=0) {
document.getElementById("b").value=score+"是质数";
/* document.write(num+"是质数")*/
}else{
document.getElementById("b ").value=score+"不是质数";
}
}
</script>
<style>
button{
margin-left: 3ex;
background-color: red;
color: #ffff;
font-family: "微软雅黑";
border: 1px solid salmon;
}
</style>
<div class="input">
<input type="text" name="" id="a" value="" />
<button onclick="fun();">查看</button>
<input type="text" id="b" />
</div>
</body>
</html>
第一次将JavaScript链接到html里面