This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

options not working in ie

 
Pat Peg
Ranch Hand
Posts: 195
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I wrote a little script to determine what item had been selected in a list and it worked fine in firefox. When I tried it in ie it fails. Here is the script.
It is suppose to take the users input from one select list and activate some other select list depending on the option selected
function getSelected(){

var temp_selected = typeList.options[typeList.selectedIndex].text;
if(temp_selected == "FRUIT")
document.getElementById("fruitList").disabled=false;

I get an error about typeList being undefined.

Here is the code in the body...

<SELECT NAME="frmType" id="typeList" onChange="getSelected()">
<OPTION value="FRUIT">FRUIT
<OPTION value="VEGGIE">VEGGIE
<OPTION value="MEAT">MEAT
</SELECT>

while you are looking at it, i have another issue that I don't even know how to start to tackle. I would like to 'roll back' or set other drop down list as the first list is changed.

In other words, if I select fruit then the fruit menu activates and I can select any fruit but if I go back to the typeList and select VEGGIE, I want to reset the value in fruitlist to N/A and deactivate it.

While that would be nice to do, I will be happy if someone can point out the fix for ie to me and explain why. I don't work with ie normally

Thnaks
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you define the variable?

You should have something like



For your other thing, sounds like you just need to remove the selection from the select element

foo.options[foo.selectedIndex].selected=false;

Eric
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I should also mention. If you look in Firefox's jS console, I am sure it has a warning about needing to reference the object correctly.

Eric
 
Pat Peg
Ranch Hand
Posts: 195
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, that looks like it did it.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic