HTML | DOM Input Image form Property

The HTML DOM Input Image form Property is used for returning the reference to the form containing the input image field. It is a read-only property that returns a form object on success.

Syntax:

imageObject.form.id

Below Example illustrate that how to return the Form Property.
Example:



filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<head>
    <title>
        HTML DOM Input Image form
    </title>
</head>
  
<body style="text-align:center;">
  
    <h1 style="color:green;"
      GeeksforGeeks 
    </h1>
  
    <h4>
      DOM Input Image form Property
    </h4>
    <button onclick="my_geek()">
        <form id="myGeeks">
            <input id="myImage" type="image" formAction="test.php"
                   src=
                   alt="Submit" width="48" height="48" formMethod="post" 
                   formNoValidate>
  
        </form>
    </button>
    <h2 id="Geek_h" style="color:green;"></h2>
    <script>
        function my_geek() {
  
            // Return target, alt and height. 
            var txt = document.getElementById(
                "myImage").form.id;
            document.getElementById(
                "Geek_h").innerHTML = txt;
        }
    </script>
</body>
  
</html>

chevron_right


Output:

  • Before Clicking On Button:
  • After Clicking On Button:

Supported Browsers: The browsers supported by HTML DOM Input Image form Property are listed below:

  • Googl Chrome 10.0
  • Firefox 4.0
  • Opera 11.0
  • Safari 5.1


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.