HTML DOM Input URL name attribute
Examples
Get the name of the field URL:
var x = document.getElementById("myURL").name;
x The output is: website
try it"
Definition and Usage
name attribute is used to set or return the name attribute value of the URL field.
name attribute is typically used to server identifiers submitted form data, or the client as a Javascript reference identification.
Note: Only the name attribute is set, in the form submission to submit data to the server.
Browser Support
All major browsers support name attribute.
Note: Internet Explorer or Safari browser does not support the use of type = "url" attribute of the HTML <input> elements.
grammar
Returns the name attribute:
urlObject .name
Setting name attribute:
urlObject .name= name
Property Value
值 | 描述 |
---|---|
name | 描述了 URL 字段的名称 |
technical details
return value: | String representing the name of the URL field |
---|
More examples
Examples
Modify the name of the field URL:
document.getElementById("myURL").name = "newNameValue";
try it"
Related Pages
HTML Reference Manual: HTML <the INPUT> name attribute
Input URL objects