$(".mainlist").append("<iframe id='dialogFrom' src='" + url + "' style='width:100%; height:100%;' marginwidth='0' marginheight='0' frameborder='0' scrolling='auto' onload='this.height=this.contentWindow.document.body.scrollHeight+5;this.width=this.contentWindow.document.body.scrollWidth+5;'/>");
tipsWindown(title, "id:dialog", $("#dialogFrom").width(), $("#dialogFrom").height(), "true", "", "true", "dialog");
在用Jquery进行操作时我先用append,但是执行到tipsWindown后append的值还没有被执行我获取不到width 和height的信息。我应该怎么办啊 !
jquery
dialog
iframe
------解决方案--------------------
iframe里面的onload写在$(xx).load(xx)里面
$('#dialogFrom').load(function(){
this.height=this.contentWindow.document.body.scrollHeight+5;
this.width=this.contentWindow.document.body.scrollWidth+5;
tipsWindown(title, "id:dialog", this.width, this.height, "true", "", "true", "dialog");
});