- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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 −
Advertisements