Javascript help
Date: 02/13/06
(Web Development) Keywords: html, java
I'm admittedly not that familiar with JavaScript but the form that I'm developing now needs me to use it as far as I can tell. I'm having some trouble though. The form is here: http://www.mccarthysparty.com/cda_registration2.html What I'm having trouble with is the first Category drop down. What should happen is when the user chooses a category, the prices should be automatically filled in to the appropriate text fields.
var Categories[
[230, 280, 330],
[460, 540, 590],
[185, 215, 255],
[185, 215, 255],
[185, 215, 255],
[185, 215, 255],
[185, 215, 255],
[30, 75, 100],
[65, 110, 150],
[30, 75, 100],
[30, 75, 100],
[75, 120, 160]];
function updateCat(id) {
eval ("var sel=document.form1.cat" + id + ".selectedIndex");
eval ("document.form1.fee" + id + "a.value = ''");
eval ("document.form1.fee" + id + "b.value = ''");
eval ("document.form1.fee" + id + "c.value = ''");
if (sel >= 0){
eval ("document.form1.fee"+id+"a.value = Categories[sel][0]");
eval ("document.form1.fee"+id+"b.value = Categories[sel][1]");
eval ("document.form1.fee"+id+"c.value = Categories[sel][2]");
}
}
Nothing happens when I change the category pull down and I can't figure out why. I'm sure it's something small and stupid.
Source: http://community.livejournal.com/webdev/295866.html