HTML DOM Password form 属性

[

Password form 属性
Password 对象

定义和用法

form 属性可返回对包含该密码域的表单的引用。
该属性将返回一个表单对象。

语法

passwordObject.form

浏览器支持

所有主要浏览器都支持 form 属性

实例

实例

下面的例子取得了该密码域所属的表单的 id:


<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<title>Break易站(runoob.com)</title>

<script>

function displayResult(){

    var x=document.getElementById("pwd").form.id;

    alert(x);

}

</script>

</head>

<body>


<form id="form1">

密码: <input type="password" id="pwd">

</form>

<button type="button" onclick="displayResult()">显示所属的表单id</button>


</body>

</html> 

Password 对象

]
转载请保留页面地址:https://www.breakyizhan.com/html/22030.html
原文地址:https://www.cnblogs.com/breakyizhan/p/13272703.html