先怎么执行alert提示框再跳转到指定页面
<%
int totalnumber =0;
totalnumber=........;
if(totalnumber <1) {
out.println( " <SCRIPT LANGUAGE= 'JavaScript '> ");
out.println( "alert( '暂无选手信息,请稍侯投票! ') ");
out.println( " </SCRIPT> ");
response.sendRedirect( "/index.jsp ");
}
%>
------解决方案--------------------先用alert()提示,然后写个js函数作用是n秒之后跳转到指定位置,用setTimeout(function,3000);
------解决方案--------------------我的愚见是,把 totalnumber <1 的判断放到前一张页面去作,如果totalnumber <1,就alter,
------解决方案-------------------- <script type= "text/javascript ">
function check(str){
if(str.value== ' '){
alert( "can 't be empty!!! ");
window.location.href= "error.jsp "
return false;
}
}
</script>
------解决方案-------------------- <%
int totalnumber =0;
totalnumber=........;
if(totalnumber <1) {
out.println( " <SCRIPT LANGUAGE= 'JavaScript '> ");
out.println( "alert( '暂无选手信息,请稍侯投票! ') ");
out.println( "document.location.href=\ "/index.jsp\ " ");
out.println( " </script> ");
}
%>