1、jquery操作iframe中的元素(2种方式)

1
2
var tha = $(window.frames["core_content"].document).find("#trewuuu").html();
var thb = $("#core_content").contents().find("#trewuuu").html();

2、操作父界面中的元素(header:为某个元素的id)

1
$('#header', parent.document).text()

3、js调用iframe中的js函数(2种)

1
2
window.frames["core_content"].window.testIframe2("11");
document.getElementById("core_content").contentWindow.testIframe2("11");

4、jquery调用iframe的js函数(带参数的会有返回值)

1
$("#core_content")[0].contentWindow.testIframe2("11");

注意事项:

要和所包含的iframe在同一个域名(因为不能跨域)

相关文章:

  • 2022-03-01
  • 2021-09-20
  • 2022-01-25
  • 2021-09-13
  • 2022-12-23
  • 2021-11-22
  • 2022-12-23
猜你喜欢
  • 2021-10-19
  • 2021-12-31
  • 2022-12-23
  • 2022-12-23
  • 2021-10-26
  • 2022-12-23
  • 2021-07-22
相关资源
相似解决方案