TUTORIALFrontendFETCHED

Input URL type 属性

Input URL type 属性 Input URL 对象 实例 返回 URL 字段的表单元素类型: var x = document.getElementById('myURL').type; x输出结果为: url 尝试一下 » 定义和用法 type 属性返回 URL 字段的表单类型类型。 对于 input type='url', 该属性通常返回 'url&#..

Updated 7/16/2026

Tutorial detail pages default to noindex.

Input URL type 属性

Input URL 对象参考手册 Input URL 对象

实例

返回 URL 字段的表单元素类型:

var x = document.getElementById("myURL").type;
x输出结果为:
url

尝试一下 »

定义和用法

type 属性返回 URL 字段的表单类型类型。

对于 input type="url", 该属性通常返回 "url"。


浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主流浏览器都支持 type 属性

注意: Internet Explorer 或 Safari 浏览器不支持使用 type="url" 属性的 HTML <input> 元素。


语法

urlObject.type

技术细节

返回值: 字符串,表示 URL 字段的表单元素类型


Input URL 对象参考手册 Input URL 对象