Hi All,
I'm not that this can be done in JavaScript, but what I'm trying to do is have a dropdown list with numbers in the list representing a quantity. I put an "onchange" on the dropdown list:
So when the user chooses a quantity it would call the function testfor(). Is this even possible? Well, the problem is that i'm not able to pass the value of "qty" to the function. I know that my syntax is wrong, but can I even do this? If so, can anyone help me with the syntax?
I'm not that this can be done in JavaScript, but what I'm trying to do is have a dropdown list with numbers in the list representing a quantity. I put an "onchange" on the dropdown list:
Code:
<script language="javascript">
var qty = document.testform.element.qty.value;
function testfor(){
for (var i=0; i<qty; i++) {
document.write('<input type="text" name= i size="20">' + ' ' + i + '<br>');
}
}
</script>
<form name="testform" method="POST">
<select size="1" name="qty" onchange="testfor()">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>