关于获取一系列文本框的值的问题。 循环!for(i=0;i<parseInt(num.value);i++) alert(eval("n"+i).value) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <script>function checkText(form){ var oText = document.getElementByTagName("INPUT"); for(i=0; i<oText.length; i++) { if (oText[i].type == "text") { if (!oText[i].value.match(/^(0\.)?\d+$/)) alert("不合法"); } }}</script><input type='button' onclick='checkText(this.form)' value='check'> <form name=form1 method=post action="" ><input type="hidden"name=n value=5><input type="text" name="n0"><input type="text" name="n1"><input type="text" name="n2"><input type="text" name="n3"><input type="text" name="n4"><input type="button" onclick="getValue()" value="getValue"></form><script language="JavaScript"><!--function getValue(){ var n = parseInt(form1.n.value); for(var i=0;i<n;i++) { var tmp = form1.all("n" + i); alert(tmp.value) if(parseFloat(tmp.value)>0) { alert("大于0") } }}//--></script> jsp 图片预加载的问题! js 时间控件 请问如何获取一个textbox或下拉框距离WINDOW的距离? ExtJs4.1.1锁定列之后出现两个复选框 正则问题(如何匹配HTML标签的属性标签) 一个文件上传域的问题,我想动态改变上传文件,能否在javascript中实现?? 小问题!!!(急) 有关把页面内容保存为EXCEL的问题 谁知道怎么缩放手机端网页 请大家帮帮忙啊!!! 关于iframe自动调整高度的问题
function checkText(form)
{
var oText = document.getElementByTagName("INPUT");
for(i=0; i<oText.length; i++)
{
if (oText[i].type == "text")
{
if (!oText[i].value.match(/^(0\.)?\d+$/))
alert("不合法");
}
}
}
</script>
<input type='button' onclick='checkText(this.form)' value='check'>
<input type="hidden"name=n value=5>
<input type="text" name="n0">
<input type="text" name="n1">
<input type="text" name="n2">
<input type="text" name="n3">
<input type="text" name="n4"><input type="button" onclick="getValue()" value="getValue">
</form><script language="JavaScript">
<!--
function getValue()
{
var n = parseInt(form1.n.value);
for(var i=0;i<n;i++)
{
var tmp = form1.all("n" + i);
alert(tmp.value)
if(parseFloat(tmp.value)>0)
{
alert("大于0")
}
}
}
//-->
</script>