The. aspx page is automatically "miscellaneous (Quirks)" When the document mode is in the low version of IE, causing the page to be altered

Source: Internet
Author: User
Tags error code
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.