By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,571 Members | 981 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,571 IT Pros & Developers. It's quick & easy.

Input text does not refresh

dorinbogdan
Expert 100+
P: 839
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>Refresh test</title>

<script language="JavaScript">

function test1(){
var str = "";
var it = document.getElementById("it");
var max = it.value;
document.body.style.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.style.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?
Feb 16 '07 #1
Share this Question
Share on Google+
4 Replies

acoder
Expert Mod 15k+
P: 16,027
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).
Feb 16 '07 #2

dorinbogdan
Expert 100+
P: 839
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.
Feb 16 '07 #3

acoder
Expert Mod 15k+
P: 16,027
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?
Feb 16 '07 #4

dorinbogdan
Expert 100+
P: 839
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.
Feb 19 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.