如何根据 this 取得数组索引值? 只能用 javascript function count_price(obj){ var arrObjs=document.getElementsByName(obj.name); alert(arrObjs[0].value);} 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <form name="tablename"><input type="text" name="price[]" onKeyUp="count_price(this);"><input type="text" name="price[]" onKeyUp="count_price(this);"><input type="text" name="price[]" onKeyUp="count_price(this);"></form><script>function count_price(obj){ var a=document.getElementsByName(obj.name); for(var i=0; i<a.length; i++) { if(a[i]==obj) { alert("index:"+ i); break; } }}</script> 用php建个留言簿发送指定邮箱,不要连接数据库,也不要发送什么outlook邮箱 怎样做当前行有数据时自动添加一空白行 禅道 邮件提醒出错...php的 IIS 不能被外部访问(详细) 需要传递的参数中有&符号怎么办 继续菜鸟问题,数据页面的显示,大家看看吧,超级菜的我不会啊 字符串转义 ADODB中使用事务插入两个表的内容,如何取得第一个表自动增加的ID? [找工作]找工作 想去上海 关于substr在处理中文时的问题? 租赁空间,有谁知道哪个公司提供服务比较好一些呢? 如何把汉字和数字混合的字符串正确地截断?
<input type="text" name="price[]" onKeyUp="count_price(this);">
<input type="text" name="price[]" onKeyUp="count_price(this);">
<input type="text" name="price[]" onKeyUp="count_price(this);">
</form>
<script>function count_price(obj)
{
var a=document.getElementsByName(obj.name);
for(var i=0; i<a.length; i++)
{
if(a[i]==obj)
{
alert("index:"+ i);
break;
}
}
}
</script>