欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

js Form.elements[i]的使用實例

 更新時間:2011年11月13日 23:36:43   作者:  
js Form.elements[i]的使用實例,這樣的代碼比document.form1的使用兼容性更好。
復(fù)制代碼 代碼如下:

//檢查表單元素是否為空
function check(Form)
{
for (i=0;i<Form.length;i++){
if(Form.elements[i].value == "")
{
//Form的屬性elements的首字e要小寫
alert(Form.elements[i].name + "不能為空!");
Form.elements[i].focus();
//指定表單元素獲得焦點
return;
}
}
Form.submit();
}
調(diào)用
<form name="form1" method="post" action="">
留 言 人:<input type="text" name="mname" size="20">
留言主題:<input type="text" name="mtext" size="66">
留言內(nèi)容:<textarea name="mnote" cols="64" rows="10" class="wenbenkuang"></textarea>
<input name="Button" type="button" class="btn_grey" value="提交"
onClick="check(form1)">
<input name="Submit2" type="reset" class="btn_grey" value="重置">
</form>

相關(guān)文章

最新評論