HTML DOM Hidden form 屬性
定義和用法
form 屬性可返回對包含隱藏輸入域的表單對象的引用。
該屬性返回form 對象。
語法
hiddenObject.form
瀏覽器支持
所有主要瀏覽器都支持form 屬性
實例
實例
下面的例子返回了該隱藏輸入域所屬的表單的id:
<html>
<head>
<script>
function displayResult()
{
var x=document.getElementById("hidden1").form.id;
alert(x);
}
</script>
</head>
<body>
<form id="form1">
<input type="hidden" id="hidden1">
</form>
<button type="button" onclick="displayResult()">显示表单form的id</button>
</body>
</html>
<head>
<script>
function displayResult()
{
var x=document.getElementById("hidden1").form.id;
alert(x);
}
</script>
</head>
<body>
<form id="form1">
<input type="hidden" id="hidden1">
</form>
<button type="button" onclick="displayResult()">显示表单form的id</button>
</body>
</html>
嘗試一下»
Hidden對象