Hello All!
I have a javascript task, and since I am not very good with
javascript, it seems I need help from the very start.
What I would ultimately like to do is create a form that,
depending on a chose select option, different text input fields
would appear.
Now, like I said, starting from the beginning, I have
problems. I can create the select field, but the onChange()
event is not working.
Here is what I have so far:
<html>
<head>
<script language=”javascript”>
function popForm()
{
alert(‘here’);
value=document.myForm.specialtype[document.myForm.specialtype.selectedIndex].value
document.write(‘here’);
if(value == “DiscountbyAmount”)
{
document.write(“DiscountbyAmount”);
alert(value);
}
}
</script>
</head>
<body>
<br><br>
<form method=”post” name=”myForm” onChange=”popForm();”>
<select name=”specialtype”>
<option value=0>Choose</option>
<option value=”DiscountbyAmount”>Discount by Amount</option>
<option value=”DiscountbyQty”>Discount by Qty</option>
<option value=”Discount”>Discount</option>
<option value=”FreeItem”>Free Item</option>
<option value=”ProdFree”>Free Item Depending on Item(s) Bought</option>
<option value=”JustAdvertise”>Just Advertise a Sale</option>
</select>
</form>
</body>
</html>
None of the dubugging alert();s or document.write();s are working. I have no idea what the problem is!! ?
Any ideas on how I can either fix what I have so far or meet my ultimate goal would be great. I have searched this forum on ways to create dynamic form fields, but none seems to give me enough info to figure it out. (remember, no real JS skills!!)
Thanks so much!
Christine ?