
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
HTML DOM Window frameElement Property
The HTML DOM Window frameElement property returns a HTML element corresponding to the window in which it is embedded such as <embed>, <iframe>, or <object>.
Syntax
Following is the syntax −
Returning window embedding element
window.frameElement
Example
Let us see an example of HTML DOM Window frameElement property −
<!DOCTYPE html> <html> <head> <title>HTML DOM Window frameElement</title> <style> * { padding: 2px; margin:5px; } form { width:70%; margin: 0 auto; text-align: center; } input[type="button"] { border-radius: 10px; </style> </head> <body> <form> <fieldset> <legend>HTML-DOM-Window-frameElement</legend> <input id="urlSelect" type="url" placeholder="Type URL here..."> <input type="button" value="Go To" onclick="goToURL()"> <div id="divDisplay"></div> </fieldset> </form> <script> var urlSelect = document.getElementById("urlSelect"); var divDisplay = document.getElementById("divDisplay"); function goToURL() { if(window.frameElement){ window.frameElement.src=urlSelect.value; divDisplay.textContent = 'Current Window is embedded'; } else divDisplay.textContent = 'Current Window is not embedded'; } </script> </body> </html>
Output
Clicking ‘Go To’ button with url field set −
Changed source of embedding element −
- Related Articles
- HTML DOM Window closed Property
- HTML DOM Window frames Property
- HTML DOM Window opener Property
- HTML DOM Window parent Property
- HTML Window length Property
- HTML Window innerHeight Property
- HTML Window innerWidth Property
- HTML Window outerHeight Property
- HTML Window outerWidth Property
- HTML Window name Property
- HTML Window screenLeft Property
- HTML Window screenTop Property
- HTML Window screenX Property
- HTML Window screenY Property
- HTML Window pageXOffset Property

Advertisements