Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-29-2010, 04:39 PM   PM User | #16
Rangers
New Coder

 
Join Date: Oct 2010
Location: Denver
Posts: 26
Thanks: 8
Thanked 0 Times in 0 Posts
Rangers is an unknown quantity at this point
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!
Rangers is offline   Reply With Quote
Old 11-07-2010, 11:14 PM   PM User | #17
connollyc4
New Coder

 
Join Date: Mar 2010
Location: New Jersey USA
Posts: 74
Thanks: 11
Thanked 4 Times in 4 Posts
connollyc4 is an unknown quantity at this point
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?
connollyc4 is offline   Reply With Quote
Old 11-08-2010, 08:21 AM   PM User | #18
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,037
Thanks: 197
Thanked 2,411 Times in 2,389 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
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.
Philip M is offline   Reply With Quote
Reply

Bookmarks

Tags
javascript, textbox, validation

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:33 PM.


Advertisement
Log in to turn off these ads.