跨浏览器问题与IE和jQuery脚本

时间:2012-05-21 17:35:57

标签: jquery internet-explorer debugging cross-browser

我有一个小的跨浏览器问题。我似乎无法让我的代码在IE中工作。如果有人能发现错误我会非常感激:

$(document).ready(function() {
    var timerId = 0;
    $('#timerwrap').ready(function() {
        $('#timerwrap').html("Please wait <strong id='show-time'>5</strong>");
        console.log(timerId)
        if (timerId == 0) {
            timerId = window.setInterval(function() {
                var timeCounter = $("#show-time").html();
                var updateTime = parseInt(timeCounter, 10) - 1;
                $("#show-time").html(updateTime);
                if (updateTime <= 0) {
                    clearTimeout(timerId);
                    $('#timerwrap').html("<a href='http://2ga.in/push/<?php echo("$item[seo]"); ?>/' target='_parent' title='Continue to <?php echo("$item[title]"); ?>'>Continue to...</a>");
                }
            }, 1000);
        }
    });
});​

1 个答案:

答案 0 :(得分:0)

I am not sure for solutions without full requirement or preview, but i found that it's showing an error because of using "" twice in "" so try with edited as below.

<script type="text/javascript">
// Only create tooltips when document is ready
$(document).ready(function() {
    var timerId = 0;
    $('#timerwrap').ready(function() {
        $('#timerwrap').html("Please wait <strong id='show-time'>5</strong>");
        console.log(timerId)
        if (timerId == 0) {
            timerId = window.setInterval(function() {
                var timeCounter = $("#show-time").html();
                var updateTime = parseInt(timeCounter, 10) - 1;
                $("#show-time").html(updateTime);
                if (updateTime <= 0) {
                    clearTimeout(timerId);
                    $('#timerwrap').html("<a href='http://2ga.in/push/<?php echo('$item[seo]'); ?>/' target='_parent' title='Continue to <?php echo('$item[title]'); ?>'>Continue to...</a>");
                }
            }, 1000);
        }
    });
});
</script>