frames collection
Represents a collection of all window objects that belong to frame and iframe elements in the current document.
The elements in the collection are sorted in source code order.
Syntax:
Possible members:
Properties:
Returns an integer that specifies the number of objects in the current collection.
This property is read-only. |
Methods:
[nameOrIndex] |
Returns an object from the current collection by name or index.
Parameters:
|
||||||||||||||
item (nameOrIndex) |
Returns an object from the current collection by name or index.
Parameters:
Return value:
If no match is found, it returns null.
If exactly one match is found, it returns the matching window object.
If more than one match is found, raises an exception.
|
Example HTML code 1:
This example illustrates the use of the frames collection:
|
|||||
<head> <script type="text/javascript"> var editorDoc; function InitEditable () { var editorWindow = window.frames["editor"]; editorDoc = editorWindow.document; var editorBody = editorDoc.body; // turn off spellcheck if ('spellcheck' in editorBody) { // Firefox editorBody.spellcheck = false; } if ('contentEditable' in editorBody) { // allow contentEditable editorBody.contentEditable = true; } else { // Firefox earlier than version 3 if ('designMode' in editorDoc) { // turn on designMode editorDoc.designMode = "on"; } } } function ToggleBold () { editorDoc.execCommand ('bold', false, null); } </script> </head> <body onload="InitEditable ();"> First, write and select some text in the editor. <br /> <iframe name="editor" src="editable.htm"></iframe> <br /><br /> You can toggle the bold/normal state of the selected text with this button: <br /> <button onclick="ToggleBold ();">Bold</button> </body> |
|||||
|
|||||
Did you find this example helpful?
|
External links:
User Contributed Comments