Ajax and Dom Run experience _ajax related

Source: Internet
Author: User
Tags tagname browser cache
Ajax in the operation of the DOM depressed for several days, today finally figured out, self-study is bitter ah, bitter a runny nose a tear,
The lesson to come out, give a wake up to the later, the veteran will not look.

The operation of XML in 1.DOM does not mix with the browser, for example, Getelementbyname is the DOM operation of the built-in document object in the browser, which you use to manipulate
Responsexml is wrong. In the browser, you can use Document.getelementsbyname (' tagname ') [0].value to get the value of the control, but in the operation
When you responsexml, you must use Getelementsbyname (' tagname ') [0].firstchild.data (NodeValue).
2. If you want to apply Responsexml, then you should write the Response.setcontenttype ("Text/xml") on the server's answering service.
If your AJAX code doesn't pass one at a time, the page may still be wrong, even after you change it correctly, and this is caused by a nasty browser cache.
The evils of the cache, I have been delayed here for at least 1 days
So you'd better write a statement on the server Answer page that prohibits caching response.setheader ("Cache-control", "No-cache");
(the number of milliseconds after the request URL + The current system is also a method.) In JS, use the new Date (). GetTime () to get the millisecond difference between the system and a specific time. ).
3. Because some of the current IE standards do not fully conform to the international consortium. For example:
Monitoring control changes We all know the onchange event, but for the text control IE does not support the OnChange property, fortunately we
Onpropertychange event to listen for text.
Again, we can use Setatrribute () to set CSS properties in browsers other than IE, but not in IE, we use
Eobj.style.stylearrtibute=value to achieve.
Related Article

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.