Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 Object form Property
The HTML DOM Object form property returns the reference of enclosing form for <object> element.
Following is the syntax −
Returning reference to the form object
ObjectElement.form
Let us see an example of Object form property −
Example
<!DOCTYPE html>
<html>
<head>
<title>HTML DOM Object form</title>
<style>
form {
width:70%;
margin: 0 auto;
text-align: center;
}
* {
padding: 2px;
margin:5px;
}
input[type="button"] {
border-radius: 10px;
}
</style>
</head>
<body>
<form id="Home Page">
<fieldset>
<legend>HTML-DOM-Object-form</legend>
<object id="objSelect" height="200" data="https://www.tutorialspoint.com/java8/images/java- 8-mini-logo.jpg"></object>
<input type="button" onclick="getObjectForm()" value="Get location of pic in website">
<div id="divDisplay"></div>
</fieldset>
</form>
<script>
var divDisplay = document.getElementById("divDisplay");
var objSelect = document.getElementById("objSelect");
function getObjectForm() {
divDisplay.textContent = 'Location of above picture: '+objSelect.form.id;
}
</script>
</body>
</html>
Output
Before clicking ‘Get location of pic in website’ button −

After checking ‘Get location of pic in website’ button −

Advertisements