
有两个文件a.html和b.html,a.html 即下面的代码,b.html只是为了验证通过时候一个跳转页面,不做任何代码编写
因为a.html用的是相对路径,所以要想程序能正常运行,b.html文件必须和a.html放在同一个目录下。
代码如下:
New Document function verify(){
var isNeed=document.getElementById("isNeed").value;
if(isNeed==1){
var reason=document.getElementById("reason").value;
if(reason==""||reason==null){
alert("预占资源原因不能为空");
}else{
window.location.href("a.html");
}
}else{
window.location.href("b.html");
}
}
script>
是否需要预占资源