在IE中旋转帖子js错误

时间:2012-03-02 20:57:39

标签: javascript posts rotation

我需要弄清楚我的代码有什么问题。对于我的客户站点(http://www.comfortsolutionsinc.net/default.aspx)在IE中,我不断收到错误消息: 消息:'document.getElementById(...)'为null或不是对象 行:59 Char:1 代码:0 URI:http://www.comfortsolutionsinc.net/data/scripts/rotating-postsnew.js

以下是我的js代码:

/*
 * Version 1.0
 */
var $rp_timer = 0;

function rp_timer_click() {
    rp_change_text(window.rp_current_post + 1);
    rp_start_timer();
}

function rp_start_timer() {
    $rp_timer = setTimeout("rp_timer_click()", window.rp_timer_sec * 1000);
    document.getElementById("rp_nav_pause").onclick = rp_stop_timer;
    document.getElementById("rp_nav_pause_normal").style.display = "inline";
    document.getElementById("rp_nav_pause_pressed").style.display = "none";
}

function rp_stop_timer() {
    clearTimeout($rp_timer);
    document.getElementById("rp_nav_pause").onclick = rp_restart_timer;
    document.getElementById("rp_nav_pause_normal").style.display = "none";
    document.getElementById("rp_nav_pause_pressed").style.display = "inline";
}

function rp_restart_timer() {
    rp_timer_click();
}

function rp_change_text($rp_current) {
    rp_start_timer();
    if ($rp_current < 0) {
        $rp_current = window.rp_number_posts - 1;
    }
    $rp_current = $rp_current % window.rp_number_posts;
    window.rp_current_post = $rp_current;
    for (i = 0; i < window.rp_number_posts; i++) {
        if (i == $rp_current) {
            $('#rp_post' + i).fadeIn(1000);
            document.getElementById('rp_nav_thumbnail' + i).className = "rp_nav_thumbnail_on";
        } else {
            $('#rp_post' + i).fadeOut(1000);
            document.getElementById('rp_nav_thumbnail' + i).className = "rp_nav_thumbnail_off";
        }
    }
}

任何想法/建议都会非常有用,请提前谢谢

0 个答案:

没有答案