Input text does not refresh

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dorinbogdan
    Recognized Expert Contributor
    • Feb 2007
    • 839

    Input text does not refresh

    I'm working on IExplorer:
    The input text (having id = "it") does not refresh at all, neither at large intervals (in the for loop).
    But the window.status is refreshed and shows correctly the counter.

    [HTML]
    <html>
    <head>
    <title>Refres h test</title>

    <script language="JavaS cript">

    function test1(){
    var str = "";
    var it = document.getEle mentById("it");
    var max = it.value;
    document.body.s tyle.cursor = 'wait';

    for(var i=max;i>0;i--){
    str += "To apply the Internet Explorer Enhanced Security Configuration to both administrators and all other users, click Next" ;
    if (i % 500 == 0){//refresh on every 500 iterations
    it.value = i;
    window.status = i;
    }

    }
    d1 = new Date();
    it.value = 0;
    document.body.s tyle.cursor = "default";
    }

    </script>
    </head>
    <body>
    <input type="button" value="Start loop" onclick="test1( )">
    <input type="text" id="it" value="5000">

    </table>

    </body>
    </html>

    [/HTML]

    Is there any trick to overcome this problem?
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    This works in firefox, so a simple guess would be that "it" must be a reserved word, so use another id and it should work (no guarantees).

    Comment

    • dorinbogdan
      Recognized Expert Contributor
      • Feb 2007
      • 839

      #3
      If call an alert(i) after it.value = i, the input is refreshed, so the problem seems to be more complicated.
      Any suggestion is welcome.

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Ok, I've tested in IE6 and I see your problem. It seems that the button freezes whilst the code runs. In that time, the text input is probably frozen even though the value is being updated.

        Anyway, why not just use setInterval instead of this code or are you using this to test speed or something?

        Comment

        • dorinbogdan
          Recognized Expert Contributor
          • Feb 2007
          • 839

          #5
          Yes, I just want to make a speed test in order to compare string concatenation against StringBuilder.
          I know that window.status can also be used but I'm still curious how could solve the refresh issue..., maybe sometime it could be useful.

          Comment

          Working...