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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.