ai3rules
05-01-2003, 04:05 PM
im just learning javascript, and wrote this small script to practice the for loop. however, i decided to add a bit to it and cant figure out how to call the c variable to the spot i am gonna indicate with a question mark.
function textgenerator()
{
var a = prompt("Enter A Number")
var c = prompt("Enter Size of Box")
for (var b=1; b <= a; b++)
document.write(b+ ". " +"<input type='text' size='?'>" +"<br>")
}
what im trying to do is generate text boxes with a number next to them, depending on the number that is entered in variable a - and that works, however i want to be able to enter a number in variable c and have that affect the size of the text boxes that will be displayed.
i hope someone can help me out - thanks alot.
function textgenerator()
{
var a = prompt("Enter A Number")
var c = prompt("Enter Size of Box")
for (var b=1; b <= a; b++)
document.write(b+ ". " +"<input type='text' size='?'>" +"<br>")
}
what im trying to do is generate text boxes with a number next to them, depending on the number that is entered in variable a - and that works, however i want to be able to enter a number in variable c and have that affect the size of the text boxes that will be displayed.
i hope someone can help me out - thanks alot.