Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jan 2009
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question option tag with javascript in IE6 issue

    Hi, I want to use the following code. In Firefox it works as I want it to, but in IE6 the javascript doesn't work - could anybody suggest a fix for me?

    Code:
    <select size='3' >
    <option onmousedown='javascript:alert("you selected ONE");'>ONE</option>
    <option onmousedown='javascript:alert("you selected TWO");' disabled='disabled'>TWO</option>
    <option onmousedown='javascript:alert("you selected THREE");'>THREE</option>
    </select>


    Thanks,
    Andy
    Last edited by andydrizen; 01-17-2009 at 07:01 PM.

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,081
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    Try this:-

    Code:
    <form name= "myform">
    <select name = "optList" onchange = "showChoice()" size='3' >
    <option value = "ONE" >ONE</option>
    <option value = "TWO">TWO</option>
    <option value = "THREE">THREE</option>
    </select>
    </form>
    
    <script type = "text/javascript">
    
    function showChoice() {
    var pick = document.myform.optList.value;
    alert ("You selected " + pick)
    }
    </script>

    We have been asked to correct our report on the wedding last week. On return from honeymoon the happy couple will be staying at The Old Manse and not as we stated at the home of the bridegroom's father. - Newspaper paragraph.

  • Users who have thanked Philip M for this post:

    andydrizen (01-17-2009)

  • #3
    New to the CF scene
    Join Date
    Jan 2009
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks :-) That deals with most of it - what about keeping one field disabled?

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,081
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    Quote Originally Posted by andydrizen View Post
    Thanks :-) That deals with most of it - what about keeping one field disabled?
    I am not too clear why you would want to do that (surely an option is an option?) but for an explanation of an IE bug see:-

    http://www.lattimore.id.au/2005/07/0...ript-solution/

    Or you might try something like:-

    Code:
    <script type = "text/javascript">
    
    function showChoice() {
    var pick = document.myform.optList.value;
    alert ("You selected " + pick);
    if (pick == "ONE") {
    alert ("That option is not available");
    return false;
    }
    }
    </script>

  • #5
    New to the CF scene
    Join Date
    Jan 2009
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks for your assistance


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •