English 中文(简体)
SCRIPT438: 对象不支持此属性或方法脚本2. js, 第92行字符 5
原标题:SCRIPT438: Object doesn t support this property or method script2.js, line 92 character 5
  • 时间:2012-05-25 17:09:04
  •  标签:
  • javascript

Firefox 和 Safari 的弹出工作, 但不在 Internet Explorer 9. 使用 Internet Explorer 9 中的 Dev 工具, 我发现以下错误( 函数 OpenPopUp 中的错误) 。

SCRIPT438: Object doesn t support this property or method script2.js, line 92 character 5

Here is <script2.js>

var popup_content_cache =   ;
var popup_content_src_id =   ;
jQuery.fn.center = function () {
    console.log("*****NEW******");
    this.css("position", "absolute");
    this.css("top", (($(window).height() - this.outerHeight()) / 2) +
                                                $(window).scrollTop() + "px");
    this.css("left", (($(window).width() - this.outerWidth()) / 2) +
                                                $(window).scrollLeft() + "px");

    console.log(this.css( top ));
    console.log(parseInt(this.css( top )));
    if (parseInt(this.css( top )) < 0) this.css( top ,  20px );

    console.log(parseInt(this.css( top )));
    return this;/*
    this.css("position","absolute");
    var top=($(window).height() - this.outerHeight())/2;

    console.log("top:  " + top)
    console.log($(window).height());
    console.log(this.outerHeight());
    if(top<0){
        console.log("** IF");
        this.css("top", "20px");
        this.css("left", (($(window).width() - this.outerWidth()) / 2) +   $(window).scrollLeft() + "px");
    }
    else {
        this.css("top", (($(window).height() - this.outerHeight()) / 2) +
                                                    $(window).scrollTop() + "px");
        this.css("left", (($(window).width() - this.outerWidth()) / 2) +
                                                    $(window).scrollLeft() + "px");
    }
    console.log();
    return this;*/
}

function openLayerBC() {
    tWidth = $(document).width();
    tHeight = $(document).height();
    //$("select").fadeOut( fast );
    $( #filter ).css("width", tWidth + "px");
    $( #filter ).css("height", tHeight + "px");
    // $( #filter ).css( z-index ,9990);
    $("#filter").css("opacity", 0.8);
    $( #filter ).fadeIn( fast );

    //$( #filter ).bind("click",closePopup1);
    $( #filter,#close ).click(function () {
        $( #filter ).fadeOut( fast );
        $( #case_light_box ).hide();
        o = document.getElementById( divid );
        o.style.display = o.style.display ===  block  ?  none  :  block ;
    });
}

function closePopup() {
    $( #filter ).fadeOut( fast );
    o = document.getElementById( popup );
    o.style.display =  none ;

    // o.style.display = o.style.display== block ? none : block ;
    $(o).css("position","absolute");
    $(popup_content_src_id).html(popup_content_cache);
    var popup_content_cache =   ;
    var popup_content_src_id =   ;
}

function openPopUp(div) {
    openLayerBC();

    div = div.replace( # ,   );
    file = div;
    page =  /v/vspfiles/templates/OSS/ajax/products/  + div +  .html ;
    $.get(page, {}, function(data)
    {
        msgbox = document.getElementById( popup );
        $(msgbox).html(data);
        $(msgbox).css( width ,$( # +div).css( width ));
        $( # +div).show();

        $(msgbox).center();
        $(msgbox).show();
    });
}

下面是 & lt; script2. js> 信件所引用的 & lt; title2. js> 行 92 。

 page =  /v/vspfiles/templates/OSS/ajax/products/ +div+ .html ;

免责声明:我继承了JavaScript的代码, 我对JavaScript及其语法没有什么经验。

问题回答

尝试在页面前添加 var :

var page =  /v/vspfiles/templates/OSS/ajax/products/ +div+ .html ;

page page 看起来它可能是未定义的。 另外, div 或 page 可能不是字符串。 您可以打开开发控制台, 在错误发生前放置 < code> debuger; 语句, 并在错误被丢弃前检查 < code> div 和 < code> page 变量, 错误被缩小范围 。





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签