Search on the Internet, about this technology to deal with a variety of methods, I only note that I learned in the video three kinds:
1, with a response.sendredirect ("target page. jsp\.htm"); achieve direct jump;
2, sometimes we need a little hint, such as "X seconds after the automatic jump, if not jump, click here", you can call the delay in the myeclipse snippets in the Go to URL. The following code is automatically generated:
The code is as follows:
<script language= "JavaScript1.2" type= "Text/javascript" >
<!--
Place the the ' Head ' section of your page.
function Delayurl (URL, time) {
SetTimeout ("top.location.href=" + URL + "'", time);
}
-
</script>
<!--Place the "Body" section---
<a href= "javascript:" onclick= "Delayurl (' mypage.html ', ' a ')" >my Delayed link</a>
Modify this code to:
The code is as follows:
<script language= "JavaScript1.2" type= "Text/javascript" >
function Delayurl (URL, time) {
SetTimeout ("top.location.href=" + URL + "'", time);
}
</script>
<span id= "Time" style= "background:red" >3</span>
Seconds after the automatic jump, if not jump, please click the link below
<a href= "target page. jsp" > target page </a>
<script type= "Text/javascript" >
Delayurl ("http://www.ablanxue.com", 3000);
</script>
You will then jump directly to the target page after 3 seconds. This method is set to jump after a few seconds in the process of the page will not change, for example, set 3 seconds, and then change over time 3 into 2 and then into 1 until jump, see the third method below.
3. Modify the code in Method 2 to:
The code is as follows:
<script language= "JavaScript1.2" type= "Text/javascript" >
function Delayurl (URL) {
var Delay=document.getelementbyid ("Time"). InnerHTML;
The last innerHTML cannot be lost, otherwise the delay is an object
if (delay>0) {
delay--;
document.getElementById ("Time"). Innerhtml=delay;
}else{
Window.top.location.href=url;
}
SetTimeout ("Delayurl ('" + URL + "')", 1000);
Here 1000 milliseconds to jump once per second
}
</script>
<span id= "Time" style= "background:red" >3</span>
Seconds after the automatic jump, if not jump, please click the link below
<a href= "target page. jsp" > topic list </a>
<script type= "Text/javascript" >
Delayurl ("http://pic.ablanxue.com");
</script>
The effect of this method is to jump to this page after clicking Submit on the previous page after 3 seconds (this 3 will be decremented to 0) after jumping to the target page.
JS implementation of the page after a few seconds automatically jump to the specified URL