日期:2014-05-16  浏览次数:20373 次

javascript中如何给表单名为变量的表单赋值
function   testsam(chkForm)
{      
      var   carttotal= "document.cart.total "+chkForm+ ".value ";
      carttotal=   "aaaaaaaa ";
}
  <form   method= "post "   name= "cart "   action= "test.asp ">
  <%  
      productlist=session( "productlist ")
      productlist=split(productlist, ", ")
      x=UBound(productlist)
      for   i=0   to   x  
      plist=ltrim(productlist(i))
      plist=Rtrim(plist)
      strsql= "select   *   from   productmanage   where   ID= ' "&plist& " ' "
      rstobj.open   strsql,cnndb,3
      %>
<select   name= " <%= "l "&i%> "   onchange= "testsam( <%=i%> ) ">
      <option     value= "0 "> test </option>
      <option     value= "1 "> test1 </option>
      <option     value= "2 "> test2 </option>
      <option     value= "3 "> test3 </option>
</select>
<input   name= " <%= "total "&i%> "   type= "text ">
      <%rstobj.movenext
      rstobj.close
      next%>
        </form>


------解决方案--------------------
那要看是什么表单控件了
text : <input type= "text " value= " <%=varname%> " >
radio/checkbox : <input type= "radio/chkbox " checked= " <%true/false%> ">
select: <select id= "dlt "> </select> <script> document.getElementById( "dlt ").value = " <%varname%> "; </script>