我相信某些浏览器需要短暂的延迟才能识别新iframe的DOM。使用超时应该可以:
$('<iframe id="myframe" name="myframe">').appendTo("body").ready(function(){ setTimeout(function(){ $('#myframe').contents().find('body').append(myContent); },50);});
我相信某些浏览器需要短暂的延迟才能识别新iframe的DOM。使用超时应该可以:
$('<iframe id="myframe" name="myframe">').appendTo("body").ready(function(){ setTimeout(function(){ $('#myframe').contents().find('body').append(myContent); },50);});