html:
<div id='logindiv' width=300 height=500><form....></form></div>js:$("<div/>").load('/getform/',{},function(i){
alert($(‘#logindiv').width);
});
这里load能拿到那个div,但是$(‘#logindiv').width打印出来却是:function (K) {
    return this[0] == l ? document.compatMode == "CSS1Compat" &&
        document.documentElement["client" + G] ||
        document.body["client" + G] : this[0] == document ? Math.max(document.documentElement["client" + G], document.body["scroll" + G], document.documentElement["scroll" + G], document.body["offset" + G], document.documentElement["offset" + G]) : K === g ? this.length ? o.css(this[0], J) : null : this.css(J, typeof K === "string" ? K : K + "px");
}
不知道为什么?

解决方案 »

  1.   

    这样看来,你调用的width是个函数,这样试试:$("<div/>").load('/getform/',{},function(i){
        alert($(‘#logindiv').width());
    });
      

  2.   


    $('#logindiv').width()或者 $('#logindiv').attr("width")
      

  3.   

    谢谢!
    现在用width()能拿到长度,但打印出来是0?
    如果用getAttribute('width'),程序跑不过去。
    我把$('#logindiv')打印出来,确实是拿到这个div。
      

  4.   

    attr('width')行了,谢谢两位!!
      

  5.   


     $('#logindiv').attr("width");一般情况下是可以的