js-Authoritative Guide Study notes 15.3

Source: Internet
Author: User

1. If you want to explicitly select a FORM element, you can index the Elements property of the Form object : document.forms.address.elements.street--a form with the name address The name is the form element for street.

2. When you index an Htmlcollection object with name and it contains multiple elements to share name, the return value is a class array object.

3. JS's Form object supports two methods:submit () and reset ().

4. Each form element has a OnSubmit event handler to detect form submissions, and a OnReset event handler to detect form resets. the Submit () and Reset () methods of the direct call form do not trigger an event handler .

5, in the event handler code, the keyword this is a reference to the document element that triggered the event , since the elements in the <form> element have a form property that references the contained form, the event handlers for those elements are always able to pass the This.form to get a reference to the Form object . The element named X in this form can be obtained by this.form.x.

6. Setting the Value property of a check box or radio element does not change the visual representation of the element. setting value changes only the string that is sent to the Web server when the form is submitted .

7. The onchange event handler for the text input field is triggered when the user enters new text or edits an existing text, indicating that the user has finished editing and moved the focus out of the text field .

8. If the user directs to a new fragment in the document, thelocation.href will change , but document. The URL does not.

9, document.write () joins its string argument, and then inserts the result string into the document where the script element is called.

10. The write () method can be used to output HTML to the current document only when parsing the document.

11. The write () method for the first call to another document erases all the contents of the document , and can be used multiple times to gradually build the contents of the new document until the close () method of the Document object is called to end the writing sequence.

12. The standard window.getselection () method returns a Selection object that describes one or more range objects that are currently selected. A function that determines the text that the user has selected in the document:

function Getselectedtext () {    if(window.getselection) {        return  Window.getSelection.toString ();    } Else if (document.selection) {//IE        return Document.selection.createRange (). text;    }}

13, there are two ways to enable the editing function. One is to set the HTML contenteditable property of any tag, and the other is to set the JS contenteditable property of the corresponding element. Setting the DesignMode property of the Document object to on causes the entire document to be editable.

js-Authoritative Guide Study notes 15.3

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.