In the previous article, we introduced three common methods for HTML pages to automatically jump after 3 seconds. This article will continue to introduce you to the relevant knowledge about HTML page jump. Let’s learn together. 1) Implementation of HTML Copy code The code is as follows:<head> <meta http-equiv="refresh" content="5;url=hello.html"> </head> Pros: Simple Disadvantage: Cannot be used in Struts Tiles 2) Implementation of JavaScript Copy code The code is as follows:<mce:script language="javascript" type="text/javascript"><!-- setTimeout("javascript:location.href='http://liting6680.blog.163.com/blog/hello.html'", 5000); // --></mce:script> Advantages: Flexible, can be combined with more other functions Disadvantages: Affected by different browsers 3) Combined with the countdown javascript implementation (IE) Copy code The code is as follows:<span id="totalSecond">5</span> <mce:script language="javascript" type="text/javascript"><!-- var second = totalSecond.innerText; setInterval("redirect()", 1000); function redirect(){ totalSecond.innerText=--second; if(second<0) location.href='http://liting6680.blog.163.com/blog/hello.html'; } // --></mce:script> Advantages: More humane Disadvantages: Firefox does not support (Firefox does not support the innerText attribute of span, div, etc.) 3) Combined with the countdown javascript implementation (firefox) Copy code The code is as follows:<mce:script language="javascript" type="text/javascript"><!-- var second = document.getElementById('totalSecond').textContent; setInterval("redirect()", 1000); function redirect() { document.getElementById('totalSecond').textContent = --second; if (second < 0) location.href='http://liting6680.blog.163.com/blog/hello.html'; } // --></mce:script> 4) Solve the problem that Firefox does not support innerText Copy code The code is as follows:<span id="totalSecond">5</span> <mce:script language="javascript" type="text/javascript"><!-- if (navigator.appName.indexOf("Explorer") > -1) { document.getElementById('totalSecond').innerText = "my text innerText"; } else{ document.getElementById('totalSecond').textContent = "my text textContent"; } // --></mce:script> 5) Integration of 3) and 3') Copy code The code is as follows:<span id="totalSecond">5</span> <mce:script language="javascript" type="text/javascript"><!-- var second = document.getElementById('totalSecond').textContent; if (navigator.appName.indexOf("Explorer") > -1) { second = document.getElementById('totalSecond').innerText; } else { second = document.getElementById('totalSecond').textContent; } setInterval("redirect()", 1000); function redirect() { if (second < 0) { location.href='http://liting6680.blog.163.com/blog/hello.html'; } else { if (navigator.appName.indexOf("Explorer") > -1) { document.getElementById('totalSecond').innerText = second--; } else { document.getElementById('totalSecond').textContent = second--; } } } // --></mce:script> The above five examples introduce five methods of using HTML to achieve automatic page jump. I hope you like them. |
>>: Solve the problem of MySql8.0 checking transaction isolation level error
Download source code git clone https://github.com...
1. Installation Tip: There is currently no offici...
Preface After reading the previous article about ...
v-for directive Speaking of lists, we have to men...
GreaseMokey (Chinese people call it Grease Monkey...
Table of contents Preface 1. Installation 1. Down...
The installation of mysql-5.7.17 is introduced be...
background As we all know, after we develop a Jav...
MySQL 4.x and above provide full-text search supp...
1. Find out whether MySQL was installed before Co...
This article shares the specific code for impleme...
Problem Record Today I was going to complete a sm...
When we develop a single-page application, someti...
Adobe Brackets is an open source, simple and powe...
Many friends have asked in forums and message are...