Javascript examples for DOM HTML Element:Input URL
The value property sets or gets the value attribute of a URL field.
Set the value property with the following Values
Value | Description |
---|---|
URL | Sets an absolute URL |
A String, representing a URL
The following code shows how to change the URL of a URL field:
<!DOCTYPE html> <html> <body> Homepage: <input type="url" id="myURL" value="http://www.google.com"> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {//w w w . ja v a2 s. com document.getElementById("myURL").value = "http://java2s.com"; document.getElementById("demo").innerHTML = 'changed'; } </script> </body> </html>