200分求解如何用 JavaScript JS 给 frame 赋值?

来源:百度知道 编辑:UC知道 时间:2024/05/30 05:04:11
http://tools.mail.163.com/sdy/hta/1006/start.htm?time=345491
例如上面这个网址,用JavaScript:document.getElementsByName("to")[0].value = "HAHA"可以完成向收件人文本框赋值。

可是如何向正文那个编辑框,也就是frame做的那个赋值?

正解200分。
1楼的老大请结合具体情况改一下,我并不是很熟悉JavaScript,虽然示例代码是自己写的。

楼上的白痴.不懂不要误导别人.
window.htmleditor.document.body.innerHTML = '内容';

var frm = document.getElementById("htmleditor").contentWindow;//获取iframe窗口对象

frm.document.body.innerHTML = "123456";//直接修改iframe中body标签中间的内容。

frm.document.getElementById("content").value = "123456";//或者这样修改iframe窗口中某一个输入框的值。

//把这段代码放到地址栏里,然后敲回车,这是在火狐下测试的
//因为这个iframe引用的是一个空白页,即: src="about:blank"
//所以空白页在火狐和IE下有差异:
javascript:var x=document.getElementById("htmleditor").contentWindow;x.document.body.innerHTML='you see ,this is the text';void(0);