Thanks to visit codestin.com
Credit goes to www.tutorialspoint.com

HTML DOM Input URL Form Property



The HTML DOM Input URL form property returns the reference of enclosing form for input URL.

Syntax

Following is the syntax −

Returning reference to the form object

inputURLObject.form

Example

Let us see an example of Input URL form property −

 Live Demo

<!DOCTYPE html>
<html>
<head>
<title>Input URL 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="Larry Page">
<fieldset>
<legend>URL-form</legend>
<label for="URLSelect">URL :
<input type="URL" id="URLSelect" size="25">
</label>
<input type="button" onclick="getform()" value="Get Co-founder">
<div id="divDisplay"></div>
</fieldset>
</form>
<script>
   var divDisplay = document.getElementById("divDisplay");
   var inputURL = document.getElementById("URLSelect");
   function getform() {
      if(inputURL.value !== '')
         divDisplay.textContent = 'Co-founder: '+inputURL.form.id;
      else
         divDisplay.textContent = 'Please enter valid URL';
   }
</script>
</body>
</html>

Output

This will produce the following output −

Before clicking ‘Get Co-founder’ button −

After checking ‘Get Co-founder’ button −

Updated on: 2019-07-30T22:30:26+05:30

116 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements