Home > Web Front-end > H5 Tutorial > Several methods to solve the problem that compatibility with IE678 does not support html5 tags_html5 tutorial skills

Several methods to solve the problem that compatibility with IE678 does not support html5 tags_html5 tutorial skills

WBOY
Release: 2016-05-16 15:50:24
Original
2184 people have browsed it

The era of html5 becoming popular has arrived. If you are still waiting for browser compatibility, it means you are already out of touch with the web. Of course, this is due to the booming development of mobile clients. If you are still wondering whether you should master HTML5 and CSS3 technologies, please slap yourself in the mouth a few times, and then study hard! Because the spring of the front end has arrived, and there is more than one spring. If you don’t believe it, I can only say: Believe it or not!
Let’s look at a standard html5 tag structure: (I’m just talking about tags here, nothing else is involved)

Copy code
The code is as follows:





html5




< ;/header>










The progress of html5 tags Of course, its semantics are more intuitive. Of course, this is just a drop in the bucket of the progress of html5. Some people suggest: Don’t say that the progress of html5 is revolutionary, but developmental! I don't disagree with this statement, but it is indeed revolutionary in some respects. I don’t want to go off topic here, let’s just talk about labels.

Of course, when you are excited about such wonderful semantic tags, you still have to ask: Does IE support it? Unfortunately, the answer is no. If you are already scared of IE, you will have to continue to endure its endless torture. (IE9 and IE10 are already compatible with HTML5 and CSS3.0)
But you have to be lucky, there are many geniuses in this era you live in. Someone has already solved this problem for you! Although, it cannot be called perfect!
Let’s look at a few methods to solve the problem of compatibility with IE678 that does not support html5 tags:
1. javascript: document.createElenment("...")
Part of the reason why IE678 doesn't support it is that they don't consider footer to be a valid html tag. So wouldn’t it be enough if we “make” it into a label? The most direct way is, of course, to create it using javascript: document.createElenment("...")!

Copy code
The code is as follows:

(function(){
var element=['header','footer','article','aside','section',' nav','menu','hgroup','details','dialog','figure','figcaption'],
len=element.length;
while(len--){
document.createElement(element[i])
}
})();

This simply creates a few typical html5 tags so that they can become tags in IE678.
Someone has already written a complete js file, you only need to import it, like this:
There is also writing


<script> <br>window.onload = function(){ <br>alert (document.getElementById("test").innerHTML "---id") <br>alert(document.getElementsByTagName("section")[0].innerHTML "---TagName") <br>alert(document. getElementsByTagName("SECTION")[0].innerHTML "---uppercase") <br>} <br></script>


< html5:section id="test">Content



Test results, IE678 all passed the test , but only the ID can be obtained in fixfox and chrome, so this method is also not a desirable method!
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template