zrp2013
获取文本内容,可是的创建时怎么也不能获取,利用FF的firebug查看到自己所写的内容在一个iframe中,于是想从iframe中获取文本,想要用
$(“ifame”).html();获取内容,可是依然不行,最终终于找到了解决方法,如下:
获取编辑器中的文本内容:
$(document.getElementsByTagName(\'iframe\')[0].contentWindow.document.body).html();(注:这个试过可以)
以下是其他获取iframe的方法:
Js代码
$(document.getElementById(\'iframeId\').contentWindow.document.body).htm()
显示iframe中body元素的内容。
Js代码
$("#testId", document.frames("iframename").document).html();
根据iframename取得其中ID为”testId”元素
Js代码
$(window.frames["iframeName"].document).find("#testId").html()

 

分类:

技术点:

相关文章:

  • 2021-11-21
  • 2021-09-17
  • 2021-11-27
  • 2021-10-03
  • 2022-01-02
  • 2021-12-01
  • 2021-11-17
  • 2021-12-07
猜你喜欢
  • 2021-11-20
  • 2021-12-23
  • 2022-01-02
  • 2022-01-02
  • 2021-10-13
  • 2021-09-17
相关资源
相似解决方案