btn.οnclick=function(){
if(txt1.value!=" "&&txt2.value!=" "){//此中不加空格,为判断是否为字符串,加空格,才为内容判断
if(!isNaN(txt1.value)&&!isNaN(txt2.value)){
show.innerHTML=num(txt1.value,txt2.value);
}else{
show.innerHTML='您输入的不是数字!';
}
}else{
show.innerHTML='请输入内容!!!';
}
}
转载于:https://www.cnblogs.com/zshome/p/4784970.html