• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

onChange in select menu, problems with

 
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.....
 
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!