开发者

Timer based redirect problem using window.location

<script language="JavaScript" type="text/javascript">
        var theBar = createProgressBar(document.getElementById('progress-bar'));

        var value;
        function resetValue() {
            value = 0;
        }

        function showProgress() {
            value += 1;
            theBar.setValue(value);

            if (value < 100) {
                window.开发者_开发知识库setTimeout(showProgress, 100);   
            }
            if (value = 100) {
                window.location = 'http://google.com';
            }   
        }
        window.onload=resetValue();showProgress();
</script>

I'm trying to redirect after the timer reaches 10 sec, but what I tried doesn`t seem to work (redirects instantly).

not familiar with JS one bit, tried my best to mimick


= means assignment

if (value == 100) { ...
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜