The support for one pair of IDS is different.
JS:
Function testinnerhtml2 (){
Alert ('start! ');
If (content. innerhtml. indexof ('id ')! =-1)
Alert ('id ');
If (content. innerhtml. indexof ('test ')! =-1)
Alert ('test ');
If (content. innerhtml. indexof ('Con '! =-1 ))
Alert ('Con ');
If (content. classname! = '')
Alert (content. classname );
}
HTML:
<Body onload = "testinnerhtml2 ();" id = "content">
<Div id = "test"> con </div>
</Body>
Ie can determine the existence of ID, test, con, and the class attribute of body is currently empty.
However, Firefox does not seem to be able to make the above judgment. (This conclusion does not seem correct !!!!)
This seems to indicate that Firefox does not support using ID directly in the expression. If you change the content in JS to document. getelementbyid ("content"), JS performs the same in both browsers.
2 display: Use of none in IE
It seems that it is useless to directly use the display: None pair Div. Add a span and use this rule for the span:
<Div> <span> </div>