js判断循环多个表单问题
一下三个表单是循环出来的,我想用js判断点击各自的提交按钮,不如我点击按钮一的时候判断表单一不能为空,如果不为空那么获取一的焦点,点击提交二的时候判断二表单不能为空,获取...
一下三个表单是循环出来的,我想用js判断点击各自的提交按钮,不如我点击按钮一的时候判断表单一不能为空,如果不为空那么获取一的焦点,点击提交二的时候判断二表单不能为空,获取二的焦点......, 各管各的怎么判断?
往高手指点?
<form name="form" action='form.php' method="post" onsubmit="return show()">
<input type="text" name="name" id="name1" />
<input type="submit" name="submit" value="提交">
</form>
<form name="form" action='form.php' method="post" onsubmit="return show()">
<input type="text" name="name" id="name2" />
<input type="submit" name="submit" value="提交">
</form>
<form name="form" action='form.php' method="post" onsubmit="return show()">
<input type="text" name="name" id="name3" />
<input type="submit" name="submit" value="提交">
</form>
................
.................. 展开
往高手指点?
<form name="form" action='form.php' method="post" onsubmit="return show()">
<input type="text" name="name" id="name1" />
<input type="submit" name="submit" value="提交">
</form>
<form name="form" action='form.php' method="post" onsubmit="return show()">
<input type="text" name="name" id="name2" />
<input type="submit" name="submit" value="提交">
</form>
<form name="form" action='form.php' method="post" onsubmit="return show()">
<input type="text" name="name" id="name3" />
<input type="submit" name="submit" value="提交">
</form>
................
.................. 展开
展开全部
<form name="form" action='form.php' method="post" onsubmit="return show()">改成
<form name="form1" action='form.php' method="post" onsubmit="return show(form1)">
<form name="form2" action='form.php' method="post" onsubmit="return show(form2)">
<form name="form3" action='form.php' method="post" onsubmit="return show(form3)">
js 函数里
function show(obj){
var f=document.obj;
if(obj=='form1'){}
if(obj=='form2'){}
if(obj=='form3'){}
}
<form name="form1" action='form.php' method="post" onsubmit="return show(form1)">
<form name="form2" action='form.php' method="post" onsubmit="return show(form2)">
<form name="form3" action='form.php' method="post" onsubmit="return show(form3)">
js 函数里
function show(obj){
var f=document.obj;
if(obj=='form1'){}
if(obj=='form2'){}
if(obj=='form3'){}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询