Javascript Help
Javascript Help
Out of context: Reply #1
- Started
- Last post
- 2 Responses
- o0o0
well... I don't know of a tutorial.. but lets see if this will help....
when you get the value out of the text field it will be a string, so you can use
intval = parseInt(txtvalue)
to make sure it's an integer...
then you can use that value in a for loop like this:sAlert = "";
for (i=0;i<intval;i++){
sAlert += Math.random() + ", ";
}
alert(sAlert);Math.random() give you a number between 0 and 1, so if you want something else (say between 1 and 5) then multiply (*5)...
that javascript might get cut out.. I'll mail it to you if it did...