1,原生的方法

首先给iframe 设置 id 属性

var obj = document.getElementById('iframe').contentWindow;
setTimeout(function(){
	// $('#iframe').contents().find('#box').html('wohao');
        obj.document.getElementById('box').innerHTML = '222';
},0)
			    

兼容ie、火狐和谷歌,具体浏览器的版本没有去测试

2,通过jquery 方法获取

$('#iframe').contents().find('#box').html('jquery');

不兼容ie

相关文章:

  • 2022-01-22
  • 2022-12-23
  • 2022-12-23
  • 2021-07-11
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-09
相关资源
相似解决方案