When you are working on an. aspx page, when you test the page with the Ie9 browser, you find that the document mode automatically switches to "Miscellaneous (Quirks)", causing the page to deform badly. After Baidu did not have the fruit, I spent nearly 2 hours of time,
Stepping through the error code, and finally surprised to find that the cause of the error is not in the foreground code, but in the. aspx.cs file in the background. In the background file I have this piece of code:
Response.Write ("<script type= ' text/javascript ' > idlength =" + maxreader["max (ID)"]. ToString () + "</script>");
This code effect is the first line in the foreground code (in <! DOCTYPE html> before) add
<script type= ' text/javascript ' > idlength = "+ (string read in database) +" </script>
This is a stiff way to define a variable for JavaScript. This destroys the entire HTML file structure, and the end result is that the document mode is automatically set to "Miscellaneous (Quirks)" on IE.
C # Background code the correct way to pass value to JavaScript should be used <%=%> in the foreground.
Read more about this blog: http://bbs.csdn.net/topics/310246363