技术社区

js跳转问题
006 | 发表于: 2020-02-15 回答

<button type="button" onclick="show()">判断大小</button>

function show(){
var abc=prompt("输入阿拉伯数字")
if (abc>25) {
document.write("大于25")
}else if(abc<25){
document.write("小于25")
}else if(abc==undefined){
window.location.href='http://www.baidu.com';
}else{
document.write("您还未输入,请返回继续输入")
}
}

当abc的值为空的时候自动跳转到一个界面,为什么跳转不了 试过了==null和 " "也不行

回复列表