php - I want to sum the looped name in textboxt in html using javascript -


i guys new php , javascript , have problem want loop name inside textbox

< form name ="rec" action="this.php" method="post" > <  ?php     x=0;     while(x <=5){      x++;      echo" < input type='text' name='n".$x."'>"; ?>  < /form> < script >    x=0;    while(x <=5){    x++;    = number(document.rec.n"+x+".value)    document.rec.n"+x+".value = a;   }  < /script> 

i hope understand php working dunno how loop inside name of javascript. need help

instead of this:

document.rec.n"+x+".value 

try this:

document.rec["n"+x].value 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -