JavaScript tutorial - entry to master (eight)

xiaoxiao2021-03-06  22

JavaScript Tutorial - From Getting Started (8) Implementing the Web Page Information Interaction with JavaScript scripts To implement dynamic interaction, you must master more complicated knowledge about Forms (FORM) and Frames. First, the formal knowledge form object allows the designer to intersect the different elements in the form to interact with client users, without having to perform data input first data input, can realize behavior of the web document. 1. What is a Form Object Form (Form): it constitutes the basic element of the web page. Usually a web page has a form or several forms, using the Forms [] array to implement different forms of access.

There are three basic elements in Forms [0], and only two elements in Forms [1]. The most important function of the form object is to directly access the form in the HTML document, which encapsulates the relevant HTML code:

2, the method of the form of the form object is only one -Submit () method, the method is the main function of implementing the commit information. If you submit the MyTest form, use the following format: Document.Mytest.Submit () 3, the properties in the properties of the form object primarily include the following: Elements name action target encoding method. Except for Elements, several other Reflect the state of the corresponding attributes in the form, which is usually a single form identifier; Elements is often an array of multiple form elements values, examples: Elements [0] .mytable.ements [1] 4, access window The body object Access the form object in JavaScript can be implemented by two ways: (1) By accessing the form, you must first specify its form name in the properties of the form, and then access the form by the following identifier such as: document. MyTable (). (2) Access the form by an array In addition to using the form name to access the window, you can also use the form object array to access the form object. However, it should be aware that the form is provided by the browser environment, and the array subscript provided by the browser environment is 0 to n. So the access of the form object can be implemented in the following format: Document.Forms [0] Document.Forms [1] Document.Forms [2] ... 5, the prerequisite for the reference form is referenced in the JavaScript The condition is: You must first create a form in the page and place the defined form part before reference. Second, the basic element in the basic element in the form is composed of a button, a radio button, a check button, a submit button, a reset button, a text box, and the like. To access these basic elements in JavaScript, you must be implemented by the array subscript or form element name corresponding to a particular form element. Each element is primarily referenced by attributes or methods of this element. The basic format of its reference is shown: formname.ersion []. MethadName (Form name. Element name or array. Method) FormName.Elemant []. PropertyName (Form name. Element name or array. Attribute) The following introduction: 1. Text single line single-column input element function: Elements in the Text ID implementation. Basic Attribute: Name: Set the information name when submitting information. Corresponds to Name in the HTML document. Value: To set information that appears in the window to correspond to Value in the HTML document. DefaultValue: The default value of the Text element is basic: blug (): Moves the current focus to the background. SELECT (): Highlight text. Main events: onfocus: This event is generated when Text gets focus. Onblur: When the focus is lost, the event is generated. OnseTelect: After the text is highlighted, the file is generated. ONCHANGE: When the TEXT element value changes, the file is generated. example:...

...