Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Need Javascript Help...
Old 12-28-2006, 06:32 PM Need Javascript Help...
KRYPTOR's Avatar
Skilled Talker

Posts: 62
Name: Ray
Location: Illinois
Trades: 0
I'm trying to create a script to do the following:
The # and = are already typed out.
After the = sign there would be an output box that the script would randomly assign
letters A-Z without duplication each time the generate box is clicked.
There would also be a grey submit box that says generate on it and each time
you click that grey box it would randomize A-Z as an example seen below.
1=Z
2=B
3=D
4=L
5=A
6=O
7=Q
8=R
9=G
10=C
11=J
12=P
13=T
14=I
15=U
16=X
17=M
18=W
19=Y
20=E
21=V
22=S
23=N
24=F
25=H
26=K

Thanks!
The KRYPTOR
__________________
"What is SEEN is TEMPORAL, What is UNSEEN is ETERNAL".


Please login or register to view this content. Registration is FREE
KRYPTOR is offline
Reply With Quote
View Public Profile Visit KRYPTOR's homepage!
 
 
Register now for full access!
Old 01-01-2007, 04:59 PM Re: Need Javascript Help...
lizard dude's Avatar
Super Talker

Posts: 119
Location: France
Trades: 0
Did not quite get what you want to do sorry
__________________
forum------->
Please login or register to view this content. Registration is FREE
, for people who wants to have a good time ;)
website------>
Please login or register to view this content. Registration is FREE
(might be in construction :D)
Hope you have a great time and that my post is helpfull ;)
lizard dude is offline
Reply With Quote
View Public Profile
 
Old 01-02-2007, 04:46 PM Re: Need Javascript Help...
KRYPTOR's Avatar
Skilled Talker

Posts: 62
Name: Ray
Location: Illinois
Trades: 0
This is what I have so far... but works with shuffling NUMBERS not LETTERS...I want it to work with LETTERS of the alphabet a-z=1-26.

function getNumbers() {
temp = 0
newnumber = 0
document.frmOne.taAll.value = ""
TA = document.frmOne.taAll
prize = new Array(26)

for (i = 1; i < 27; i++) {
prize[i] = i
}
for (i = 1; i < 27; i++) {
newnumber = (Math.random() * 26) + 1
newnumber = parseInt(newnumber, 10)
temp = prize[i]
prize[i] = prize[newnumber]
prize[newnumber] = temp
}
for (i = 1; i < 27; i++) {
TA.value = TA.value + "Case#[" + i + "] = " + prize[i] + "\n"
}

}

I need to add the following somehow to replace the NUMBERS above with LETTERS

var letters = new Array("a","b","c","d","e","f","g","h","i","j","k", "l","m","n","o","p","q","r","s","t","u","v","w","x ","y","z");

just not sure how to do it???

The KRYPTOR
__________________
"What is SEEN is TEMPORAL, What is UNSEEN is ETERNAL".


Please login or register to view this content. Registration is FREE
KRYPTOR is offline
Reply With Quote
View Public Profile Visit KRYPTOR's homepage!
 
Old 01-02-2007, 04:51 PM Re: Need Javascript Help...
willcode4beer's Avatar
Super Moderator

Posts: 1,533
Name: Paul Davis
Location: San Francisco
Trades: 1
Did this
http://www.webmaster-talk.com/javasc...tml#post328316
not work for you?
willcode4beer is offline
Reply With Quote
View Public Profile
 
Old 01-02-2007, 06:27 PM Re: Need Javascript Help...
KRYPTOR's Avatar
Skilled Talker

Posts: 62
Name: Ray
Location: Illinois
Trades: 0

Hmm I will try this out but I have one question
Will the line
(Math.random() * 26) + 1
recognize or "count" each array value in
var letters = new Array("a","b","c","d","e","f","g","h","i","j","k", "l","m","n","o","p","q","r","s","t","u","v","w","x ","y","z");

The KRYPTOR
__________________
"What is SEEN is TEMPORAL, What is UNSEEN is ETERNAL".


Please login or register to view this content. Registration is FREE
KRYPTOR is offline
Reply With Quote
View Public Profile Visit KRYPTOR's homepage!
 
Old 01-02-2007, 08:43 PM Re: Need Javascript Help...
willcode4beer's Avatar
Super Moderator

Posts: 1,533
Name: Paul Davis
Location: San Francisco
Trades: 1
I believe that it will prevent you from ever getting the first element of the array (element zero)
willcode4beer is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Need Javascript Help...
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.49788 seconds with 12 queries