Jump to content

Loop problem


robert_gsfame

Recommended Posts

I have two form n i wish to move the record from first form to another form

 

var lengthx=document.form4.elements.length;

var length=document.form3.elements.length;

  var choosex="";

  for(var x=0;x<lengthx;x++){

  if(document.form4.elements[x].type=="checkbox"){

  for(var y=0;y<length;y++){

  if(document.form4.elements[x].value!==document.form3.elements[y].value){

  choosex=choosex+"<tr><td>"+document.form3.elements[y].value+"</td></tr>";}}}}

 

    document.getElementById("datauser").innerHTML="<form name=form4><table width=357>"+choose+"</table></form>";

  }

 

when i choose one record from form3, everything goes correctly...but when i choose more records at the same time then records in form3 duplicate so if let say i have 4 records and i choose 2 records then i will have 8 records

 

which part of looping is incorrect?? thx

Link to comment
https://forums.phpfreaks.com/topic/200016-loop-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.