$("#b").append("<iframe frameborder='0' border='0' style='width:expression(this.nextSibling.style.width);height:expression(this.nextSibling.style.height);position:absolute;z-index:1;top:0;left:0;'></iframe>").append($("a")).css({position:"absolute"});jquery报错,怎么才能使expression正常使用。

解决方案 »

  1.   

    楼主你在css里面写expression不兼容的。试下添加iframe以后在改变它的尺寸$("#b").append(" <iframe frameborder='0' border='0' id='iframe1' style='position:absolute;z-index:1;top:0;left:0;'> </iframe>").append($("a")).css({position:"absolute"});$("#iframe1").css({width:$("#iframe1").next().width(),height:$("#iframe1").next().height()});
      

  2.   

    我只是要在ie6下使用其他浏览器不用iframe.
      

  3.   

    先APPEND Iframe 不要带样式之后再给IFRAME 添加  STYLE好比原来 this.nextSibling.style 这个在生成IFRAME对象后 实际还未被APPEND this.nextSibling==null 肯定出错了我估计是这个原因
      

  4.   

    expression似乎只能放在css文件里面,jQuery也不支持这种写法
      

  5.   

    $("#b").append(" <iframe frameborder='0' border='0' style='width:expression($(this).scrollWidth);height:expression($(this).scrollHeight);position:absolute;z-index:1;top:0;left:0;'> </iframe>").append($("a")).css({position:"absolute"}); 你的问题不在于jquery,而在于expression的用法,一般用scrollHeight和scrollWidth获取高宽度。