Document and plain letter Doc ument

Source: Internet
Author: User

normally, when I write a javascriptkey, there is a difference between the client and the zookeeper Doc ument. In actual use, there are no problems, but this poses a huge risk. When a problem occurs, this bug becomes very difficult to find.
Code :
test1.jsp:



test1.jsp </ title>




Test2.jsp:
<! Doctype HTML public "-// W3C // dtd html 4.0 transitional // en">
<HTML>
<Head>
<Title> test2.jsp </title>
</Head>
<Script language = 'javascript '>
Function Showa (){
Alert (document. getelementbyid ('input2'). value );
}
Function showb (){
Alert(registry.doc ument. getelementbyid ('input2'). value );
}
</SCRIPT>
<Body>
<Input id = 'input2' type = 'text' name = 'name2' value = 'ph2'/> <br>
<Input type = 'button 'name = 'butt1' value = 'showa () 'onclick = 'javascript: Showa ();'/> <br>
<Input type = 'button 'name = 'butt2' value = 'showb () 'onclick = 'javascript: showb ();'/> <br>
</Body>
</Html>

Is Showa () different from showb? Most machines do not have them, but they still exist. Today I met them. A user youxing told me that showb () on his notebook would have an error. (The operating system, browser version, and settings are the same. It's strange !)
Question: When test2.jspis in iframe, does the temporary Doc ument refer to the document in IFRAME or the document outside?

Therefore, the blog reminds you that you can omit window.

 

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/rekcah_ph/archive/2005/08/30/467859.aspx

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.