Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

onChange in select menu, problems with

 
Justin Beattie
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey, thanks in advance for respoding. This is a javascript question about the onChange event handler. I'm trying to dynamically modify a table based on what elements are selected in drop downs. Here's code for one of them:
<select name="cpu" onChange="updateList(0);">
<option selected>-- - - - --Select CPU-- - - - --</option>
<option value="AMD DURON 800&49.99"> AMD Duron 800 </option>
<option value="AMD DURON 850&59.99"> AMD Duron 850 </option>
< !--....and so on, and so on....-->
</select>

Now, i have several of these. Here's the updateList function:
function updateList(ntype)
{
var selected;
if(ntype==0){
selected=cpu.selectedIndex;
svalue=cpu.options[selected].value;}
< !-- ntype is dependant on which drop down menu is selected. Each drop down contains various computer components grouped together -->
strings = svalue.split("&");
sname = strings[0];
fcost = parseInt(strings[1]);
list.firstChild.ChildNodes[0].firstchild.firstchild.nodevalue="AMD DURON 800";
list.firstChild.ChildNodes[0].childNodes[1].firstchild.nodevalue="49.99";

return;
}

As far as i know, the problem is not with the function but in the function call. I am using MSIE 6.0 and whenever i select "AMD DURON 800" from the select box, i get an error message at the function call line saying "object expected" (error code 0). Any suggestion? Thanks.....
 
Dave Vick
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Justin
You posted this in the Java in General forum, I'm moving it to the HTML/Javascript froum where you'll probably get a better response.
Dave
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic