Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18
  1. #16
    New Coder
    Join Date
    Oct 2010
    Location
    Denver
    Posts
    26
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Philip M View Post
    Here is A COMPLETELY REVISED VERSION which as far as I can tell works perfectly.
    as far as I can see works perfectly for me too!!

    Thanks Philip!

  2. #17
    New Coder
    Join Date
    Mar 2010
    Location
    New Jersey USA
    Posts
    81
    Thanks
    13
    Thanked 4 Times in 4 Posts
    is there any way to have all the numbers 1-6 in a text area and every time a number is used it is taking away from the box. Or even the opposite, every time a number is entered it goes into a text area?

  3. #18
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,984
    Thanks
    203
    Thanked 2,536 Times in 2,514 Posts
    Add to your form a textarea named ta1.

    Code:
    <textarea name = "ta1" rows = "2" cols = "14">1 2 3 4 5 6</textarea>
    Then add the folllowing script code after testDups();
    Code:
    var numbers = [1,2,3,4,5,6];
    var  arr = [];
    arr[0] = document.myForm.one.value;
    arr[1] = document.myForm.two.value;
    arr[2] = document.myForm.three.value;
    arr[3] = document.myForm.four.value;
    arr[4] = document.myForm.five.value;
    arr[5] = document.myForm.six.value;
    
    for (var i = 0; i<numbers.length; i++) {
    for (var j = 0; j<arr.length; j++) {
    if (arr[j] == numbers[i]) {
    numbers[i] = "";
    }  // remove used numbers
    }
    }
    
    var noblanks = [];
    for (var i =0; i<numbers.length; i++) {
    if (numbers[i]){ noblanks.push(numbers[i])} 
    }
    var joined = noblanks.join(" ");
    document.myForm.ta1.value = joined;

    I do hope that this is not going to be one of these things where modifications are repeatedly requested. It would be a lot easier to take these requirements into account at the outset. And I get the impression that you have sufficient expertise to make this modification yourself.


 
Page 2 of 2 FirstFirst 12

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •