25.133. Form.elements[]: the input elements of a formDOM Level 2 HTML25.133.1. Synopsisreadonly HTMLCollection elements 25.133.2. Description
elements[]
is an
25.133.3. Usage
If an item in the
elements[]
array has been given a
form.name 25.133.4. See AlsoInput , HTMLCollection , Select , Textarea |
25.134. Form.
|
25.135. Form.onsubmit: event handler invoked when a form is submittedDOM Level 025.135.1. SynopsisFunction onsubmit 25.135.2. Description
The
onsubmit
property of a Form object specifies an
If the onsubmit handler returns false , the elements of the form are not submitted. If the handler returns any other value or returns nothing, the form is submitted normally. Because the onsubmit handler can cancel form submission, it is ideal for performing form data validation. See Element.addEventListener( ) for another way to register event handlers. 25.135.3. See Also
Element.addEventListener( )
,
Form.
|
25.136. Form.reset( ): reset the elements of a form to their default valuesDOM Level 2 HTML25.136.1. Synopsisvoid reset( ); 25.136.2. Description
This method resets each element of a form to its default value. The results of calling this method are like the results of a
25.136.3. See AlsoForm.onreset , Form.submit( ) |
25.137. Form.submit( ): submit form data to a web serverDOM Level 2 HTML25.137.1. Synopsisvoid submit( ); 25.137.2. Description
This method submits the values of the form elements to the server specified by the form's
action
property. It submits a form in the same way that a
25.137.3. See AlsoForm.onsubmit , Form.reset( ) |
25.138. Frame: a <frame> in an HTML document
DOM Level 2 HTML: Node
|
|
Property |
Attribute |
Description |
|---|---|---|
|
String frameBorder |
frameborder |
Set to "0" for borderless frames |
|
String longDesc |
longdesc |
The URL of a frame description |
|
String marginHeight |
marginheight |
Top and bottom frame margin, in pixels |
|
String marginWidth |
marginwidth |
Left and right frame margin, in pixels |
|
String
|
name |
The name of the frame, for DOM Level 0 lookup and form and link targets |
|
boolean noResize |
noresize |
If
true
,
|
|
String scrolling |
scrolling |
Frame scroll policy: "auto", "yes", or "no" |
Frames have a dual nature and may be represented in client-side JavaScript by either Window or Frame objects. In the traditional Level 0 DOM, each <frame> is treated as an independent window and is represented by a Window object, referenced by name, or as an element of the frames[] array of the containing Window:
// Get a frame as a Window object var win1 = top.frames[0]; // Index frames[] array by number var win2 = top.frames['f1']; // Index frames[] array by name var win3 = top.f1; // Get frame as a property of its parent
When frames are
In the Level 2 DOM, <frame> elements can be looked up by ID or tag name, just as any other document element can be:
// Get a frame as a Frame object
var frame1 = top.document.getElementById('f1'); // by id
var frame2 = top.document.getElementsByTagName('frame')[1]; // by tag name
When frames are looked up using DOM
<iframe> elements are very similar to <frame> elements. See the IFrame reference page.
Note that the
IFrame , Window ; Chapter 14