<html>
<head>
<title></title>
<script>
function checkTextValue(){
if(getValue('t1').indexOf(' ')!=-1)f1.innerHTML='不能包含空格'
else f1.innerHTML=''
if(getValue('t2').length<10)f2.innerHTML='不能少于10个字'
else f2.innerHTML=''
if(getValue('t3')!=getValue('t2'))f3.innerHTML='必须跟输入框2的值一样'
else f3.innerHTML=''
var str4 = getValue('t4')
var flag = false
for(var i=0i<str4.lengthi++){
var str = str4.charAt(i)
if(str.toString() == '是'){flag = truebreak}
}
if(flag)f4.innerHTML="输入的值中不能包含'是'"
else f4.innerHTML=''
}
function getValue(id){
return document.getElementById(id).value
}
</script>
</head>
<body>
输入框1:<input type="text" id="t1"><font id="f1" color=red></font><br />
输入框2:<input type="text" id="t2"><font id="f2" color=red></font><br />
输入框3:<input type="text" id="t3"><font id="f3" color=red></font><br />
输入框4:<input type="text" id="t4"><font id="f4" color=red></font><br />
<input type="button" value="验证" onclick="checkTextValue()">
</body>
</html>
先取该行的indexvar index=$(this).index()
然后再取数据
var conut = $(x).parent().parent().find("input:eq("+index+")[name=txt_count]").val()
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)