passing dynamic id's to javascript -


I have a time loop that changes the ID of each input field

  print " Input style = \" text-align: center \ "type = text name = productitemsupdate_ $ num value = \" $ row [productitems] \ "size = 5 id = pro $ num & Gt;} & lt; / td & gt; "; & Lt; Pro0   

above should be produced if I have 3 orders, then I should have 3 id

id- pro0 id-pro1 id-pro2

In my javascript I want to call the ID such as

  var pro = form.pro0.value; If (Pro == "") {inlineMsg ('support', 'you can not leave it empty.', 10); return false; }   

The problem is that the price does not work.

It works with a variable like things go outside of the loop, but when I want to send the ID from inside, they do not work. Loop.

kardklub

form.pro0.value;

is used to name the input as pro0

try.productitemsupdate_0. Try using or

getElementById

Also replace your php code with

  Print "& gt; Input style = \" text-align: center \ "type = \" text \ "name = \" productitemsupdate_ $ num \ "value = \" $ line [productitems] \ "size = \ "5 \" id = \ "pro $ number \" & gt;} & lt; / td & gt; ";    

Comments