zoukankan      html  css  js  c++  java
  • Option onClick in Internet Explorer

    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:

    Code: [ Download ] [ Select ]  [ Line Numbers Off ]
    <select name='Type'>
    <option onClick='dm();' onSelect='dm();' value='DM'>Option 1</option>
    <option onClick='rm();' onSelect='rm();' value='RM'>Option 2 </option>
    </select>
    1. <select name='Type'>
    2. <option onClick='dm();' onSelect='dm();' value='DM'>Option 1</option>
    3. <option onClick='rm();' onSelect='rm();' value='RM'>Option 2 </option>
    4. </select>


    (As you can see, I've defined both onClick and onSelect trying to make it work).

    The javascript code is in a file called util.js. This is the code:

    Code: [ Download ] [ Select ]  [ Line Numbers Off ]
    function dm(){
        alert("OK");
        document.newMalForm.menuB.disabled="disabled";
        return;
    }

    function rm(){
        alert("OK");
        document.newMalForm.menuB.disabled=false;
        return;
    }
    1. function dm(){
    2.     alert("OK");
    3.     document.newMalForm.menuB.disabled="disabled";
    4.     return;
    5. }
    6. function rm(){
    7.     alert("OK");
    8.     document.newMalForm.menuB.disabled=false;
    9.     return;
    10. }



    The javascript file is included using this tag:

    Code: [ Download ] [ Select ]
    <script type='text/javascript' src='util.js' language='JavaScript'></script>



    Now, this works in firefox but not in IE. In fact, IE doesn't even run the functions as the alert (called in the javascript file) isn't shown when I click the menu options. What is the problem?

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

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

  • 相关阅读:
    window.location.href的使用方法
    hdu 2850 Load Balancing (优先队列 + 贪心)
    几种常见模式识别算法整理和总结
    【DateStructure】 Charnming usages of Map collection in Java
    编写你自己的单点登录(SSO)服务
    微软历史最高市值是多少?
    Tomcat配置一个ip绑定多个域名
    递归算法:求序列的全排列
    SMTP协议分析
    platform_device与platform_driver
  • 原文地址:https://www.cnblogs.com/philzhou/p/1832317.html
Copyright © 2011-2022 走看看