//数量的那个栏目 
<input type="text" size="4" value="$rs[num]" name="product[{$rs[aid]}]">
//自己添加的
        <input type="button" name="Submit" onmouseup="product[{$rs[aid]}].value++;" value="加">
        <input type="button" name="Submit" onmouseup="product[{$rs[aid]}].value--;" value="减">但是运行的时候报product未定义,我想就是获得那个text的name不知道怎么获得。
请高手赐教。 
问题补充:或者给帮我写一个另外的方法实现这个功能,感谢了。

解决方案 »

  1.   


    <input type="text" size="4" value="1" name="product[I]" id="product[I]">
      <input type="button" onmouseup="document.getElementById('product[I]').value++;"
     value="加">
      <input type="button" onmouseup="document.getElementById('product[I]').value--;"
     value="减">
      

  2.   

    <input type="text" size="4" value="$rs[num]" name="product[{$rs[aid]}]" id="INP">'
    //自己添加的
      <input type="button" name="Submit" onclick ="jia();"value="加">
      <input type="button" name="Submit" onclick ="jian();"value="减">function jia(){document.getElementById(INP).value++
    }
      

  3.   

    非常感谢,我的问题解决了。
    我采用了1楼的方法。
    <input type="button" name="Submit" onmouseup="document.getElementById('product[{$rs[aid]}]').value++;" value="加">  
    <input type="button" name="Submit" onmouseup="document.getElementById('product[{$rs[aid]}]').value--;" value="减">