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
    Regular Coder
    Join Date
    May 2009
    Posts
    143
    Thanks
    14
    Thanked 1 Time in 1 Post

    Internet Explorer IE refresh? repaint? whatever?

    hey there

    i'd like to know why when I clear a text input in IE via javascript I need to click somewhere on the screen for the change to appear?

    Code:
    document.getElementById("strAuteur").value="";
    //This wont trigger a repaint for IE
    edit : SOLUTION -> use onclick instead of onchange.
    Last edited by Jahren; 06-19-2009 at 08:12 PM.

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,730
    Thanks
    202
    Thanked 2,507 Times in 2,485 Posts
    Not sure what you mean. You need to show us more (relevant) code.

    This works normally.

    Code:
    <input type = "text" name = strAuteur" id = "strAuteur" onblur = "clearit()">
    
    <script type = "text/javascript">
    function clearit() {
    document.getElementById("strAuteur").value="";
    }
    </script>

    Quizmaster: What is the English translation of the French word voiture?
    Contestant: A tree.

  • #3
    Regular Coder
    Join Date
    May 2009
    Posts
    143
    Thanks
    14
    Thanked 1 Time in 1 Post
    alright

    Code:
    <input type='checkbox' name='chkAuteur' id='chkAuteur' onchange='if(!this.checked)document.getElementById("strAuteur").value="";' />
    <label>Auteur: </label><input type='text' name='strAuteur' id='strAuteur' />
    basic code
    When you uncheck the box, the text field empties itself.
    FF repaints the window while IE requires me to click somewhere in the screen to repaint the input NOW without text

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,730
    Thanks
    202
    Thanked 2,507 Times in 2,485 Posts
    Use onclick and not onchange.

    For some reason Internet Explorer only fires the onchange event when the checkbox loses the focus (onblur).

  • Users who have thanked Philip M for this post:

    Jahren (06-19-2009)

  • #5
    Regular Coder
    Join Date
    May 2009
    Posts
    143
    Thanks
    14
    Thanked 1 Time in 1 Post
    Wow, Not only did it fix this refreshing problem, but you also repaired my other topic whereas IE could only change the selectedIndex once!

    Thanks a bundle


  •  

    Posting Permissions

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