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>
