aspose file tools*
The moose likes Beginning Java and the fly likes onChange in select menu,  problems with Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "onChange in select menu,  problems with" Watch "onChange in select menu,  problems with" New topic
Author

onChange in select menu, problems with

Justin Beattie
Greenhorn

Joined: Nov 28, 2001
Posts: 9
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

Joined: May 10, 2001
Posts: 3244
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


Dave
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: onChange in select menu, problems with