Input URL valueProperty

Input URL 对象参考手册Input URL Object

Example

Change the value of the URL field:

document.getElementById("myURL").value = "http://www.google.com";

Try it yourself »

Definition and Usage

The value property is used to set or return the value of the value attribute of the URL field.

The value property describes the value entered by the user, the default value, or the value entered by a script.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the value property

Note:Internet Explorer or Safari browsers do not support HTML <input> elements with the type="url" attribute.


Syntax

Return the value property:

urlObject.value

Set the value property:

urlObject.value=URL

Property Values

Value Description
URL Describes an absolute URL address (e.g., "http://www.w3cschool.cc")

Technical Details

Return value: A string representing the value of the URL field


More Examples

Example

Get the value of the URL field:

var x = document.getElementById("myURL").value;
xThe output result is:
http://www.example.com

Try it yourself »


Related Pages

HTML Reference Manual:HTML <input> value Attribute


Input URL 对象参考手册Input URL Object Other Extensions