《JSP实现页面自动跳转.doc》由会员分享,可在线阅读,更多相关《JSP实现页面自动跳转.doc(3页珍藏版)》请在金锄头文库上搜索。
1、一些页面自动跳转的实现 功能:8秒后,自动跳转到同目录下的return.html文件 1)html的实现2)javascript的实现 setTimeout(javascript:location.href=return.html, 8000); 3)结合了倒数的javascript实现(IE)8var second = totalSecond.innerText;setInterval(redirect(), 1000);function redirect() totalSecond.innerText=-second; if(second0) location.href=return.ht
2、ml;3)结合了倒数的javascript实现(firefox) var second = document.getElementById(totalSecond).textContent; setInterval(redirect(), 1000); function redirect() document.getElementById(totalSecond).textContent = -second; if (second 0) location.href = return.html; 4)解决Firefox不支持innerText的问题8if(navigator.appName.in
3、dexOf(Explorer) -1) document.getElementById(totalSecond).innerText = my text innerText; else document.getElementById(totalSecond).textContent = my text textContent;5)整合3)和3)8 var second = document.getElementById(totalSecond).textContent; if (navigator.appName.indexOf(Explorer) -1) second = document.
4、getElementById(totalSecond).innerText; else second = document.getElementById(totalSecond).textContent; setInterval(redirect(), 1000); function redirect() if (second -1) document.getElementById(totalSecond).innerText = second-; else document.getElementById(totalSecond).textContent = second-; 不在jsp页面中嵌套java代码片段function delayedRedirect()window.location = http:/localhost:8080/redirect/login.jsp;3秒钟后将自动跳转到登陆页面