通过js向富文本框输入:我很好

public void setContent(String content) {
        String js = "document.getElementById('content_ifr').contentWindow.document.body.innerHTML='我很好'";
        ((JavascriptExecutor)dr).executeScript(js);  //dr强制类型转换JavascriptExecutor,执行js
}

contentDocument 容纳框架的内容的文档。返回 frame/iframe 生成的文档对象。  
contentWindow 返回 frame/iframe 生成的 window 对象。

document.body.innerHTML    //在网页中所要显示出来的内容, 

document.body.innerHTML = "nnnn";   //网页中显示:nnnn

 

http://www.runoob.com/jsref/dom-obj-frame.html

 

http://www.runoob.com/ 一个资料全的网站

 

相关文章:

  • 2022-12-23
  • 2021-12-28
  • 2022-12-23
  • 2022-01-01
  • 2022-12-23
  • 2021-09-19
猜你喜欢
  • 2022-12-23
  • 2021-06-18
  • 2022-12-23
  • 2021-10-31
  • 2021-11-13
  • 2022-12-23
  • 2021-08-05
相关资源
相似解决方案