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 4 of 4
  1. #1
    New Coder
    Join Date
    Jan 2011
    Posts
    42
    Thanks
    1
    Thanked 0 Times in 0 Posts

    onkeyup handler for IE

    Hi,

    I have the following code. This code is working fine in FF but not in IE.

    Can any one let me know how i can resolve this.

    function handlerFunc (elem, elem1) //elem1 is id of input tag
    {
    elem.onKeyUp = keyupHandler (elem1); //throwing error in IE. If i remove argument it is working fine, but i want to make it work with arguments.

    }

    function keyUpHandler (elem1)
    {
    alert (elem1.form.name);
    }

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,147
    Thanks
    203
    Thanked 2,547 Times in 2,525 Posts
    For IE it is necessary to have at least two fields - one can be hidden/dummy:-
    Code:
    <div style="display:none">
    <input type="text" name="hiddenTextField">
    </div>
    All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #3
    New Coder
    Join Date
    Jan 2011
    Posts
    42
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I didnot get your reply. Could you please explain in detail.

  • #4
    Regular Coder
    Join Date
    Aug 2010
    Posts
    974
    Thanks
    19
    Thanked 212 Times in 210 Posts
    I really cant tell from the code
    what you want ?

    maybe this ?

    Code:
    <form name="nm">
    <input id="i1" >
    <input id="i2" name="i2">
    </form>
    
    
    <script>
    function handlerFunc (elem, elem1) 
    {
    elem.onkeyup = function ()
    {
    alert (elem1.name); 
    } ; 
    }
    
    
    
    var i1 = document.getElementById("i1");
    var i2 = document.getElementById("i2");
    
    handlerFunc (i1, i2) ;
    </script>
    Last edited by DaveyErwin; 07-28-2011 at 07:42 PM.


  •  

    Posting Permissions

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