First, let's take a look at this article:
Differences between innerhtml in IE, Firefox, and chrome
Http://buzheng.org/web-front/difference-of-implements-of-innerhtml-in-ie-and-firefox/
The difference between the processing methods of different browsers when there are unclosed tags.
Recently, the project will be migrated from IE6 to chrome. A good piece of code is not executed now:
View code 1 If ({('{divstudy'}.html () = ''){
2 $. Post (URL ,{...})}
Document. getelementbyid (). innerhtml consistent results
The content of the DIV is as follows:
1 <! -- Modify residence information -->
2 <Div id = "divstay" class = "tabstyle">
3 </div>
The result of executing alert is
Alert(((((filldiv).html () = ''); -- blank in the false prompt box
Alert(((filldiv).html (). Length); -- 9
After checking that there is no blank space in divstay, I am surprised. How did this 9 come out? After an hour of failure, I move the mouse cursor to </div> and click back. After 9, it becomes:
<Div id = "divstay" class = "tabstyle"> </div>
Depend! Is this the reason? Sure enough, after alert again, the length is 0.
Summary: IE determines that the content in the start and end separation of the label caused by carriage return is empty. Chrome determines that after carriage return, nine space characters (maybe other numbers) will be generated)