IE does not support the event of the option in select control

Source: Internet
Author: User

In a page that I am working on right now I have this problem:

I have a dropdown menu using select . this menu has two options. what I want to happen is that when I click the first Option another dropdown menu (let us call it B), is disabled. and when I click the second Option , Menu B is enabled. I 've tried to solve it this way:
line number on/offcode: select all select name = 'type'>
Option onclick = 'dm (); 'onselect = 'dm (); 'value = 'dm'> Option 1 Option
Option onclick = 'rm (); 'onselect = 'rm (); 'value = 'rm'> Option 2 Option
select

(As you can see, I 've defined bothOnclickAnd onselect trying to make it work ).

The javascript code is in a file called util. js. This is the code: line number on/offcode:SelectAllfunction DM (){
Alert ("OK ");
Document. newmalform. menub. Disabled = "disabled ";
Return;
}

Function RM (){
Alert ("OK ");
Document. newmalform. menub. Disabled = false;
Return;
}

The Javascript file is wrongly ded using this tag: line number on/offcode:SelectAll <SCRIPT type = 'text/JavaScript 'src = 'util. js' Language = 'javascript '> </SCRIPT>

Now, thisWorks in Firefox but not in IE.
In fact, ie doesn' t even run the functions as the alert (called in
Javascript file) isn' t shown when I click the menu options. What is
Problem?

Edit: the alert only exists in debug purpose. And I also wanted to say that this is my first post in this forum!

More editing, to clarify: newmalform is the form that contains both of the dropdown menus.

---- Solve

Remove the events fromOptions, Use an event directly onSelectInstead.

Internet Explorer treatsSelect
Boxes slightly different than the rest of the document, (if you 've ever
Read anyhting about "Your wed controlls" you know what I'm talking
About)

I'm thinking ie doesn't notice events in childnodesSelectElements, onlySelectElements themselves.

I normally setup my functions to work depending on either of the selectsValueOrSelectedindexAttribute & usingOnchangeEvent.

Line number on/offcode: Select All

Function DIS (state ){
VaR disstate = State = 1;
Alert (disstate );
}

...

select onchange = "dis (this. selectedindex) ">
Option disabled Option
Option enabled Option
select

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.