楼主看下这两个页面是怎么传值的,希望对你有帮助:)
main.html
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<script language="JavaScript">
<!--
function init()
{
document.all.doc_html.contents = "kisslan :)";
}
//-->
</script>
</head><body bgcolor="#FFFFFF" onload="init()">
<object id="doc_html" name="doc_html" width=598 height=320 data="edit.html" type="text/x-scriptlet"></object>
</body>
</html>
edit.html
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="javascript">
var targetDoc;
public_description = new editor;
function editor()
{
this.put_contents = PutContents;
}
function PutContents(contents)
{
targetDoc.designMode = "On";
if (target.document.all["cdiv"]!=null) target.document.all["cdiv"].innerHTML = contents;
else target.document.body.innerHTML = contents;
}
</script>
</head>
<body onload="editor()">
<iframe id=target name=target scrolling="yes" marginwidth=1 style="HEIGHT: 100%; WIDTH: 100%">
</iframe>
</script>
</body>
<script>
targetDoc = document.frames.target.document;
targetDoc.designMode = "On";
</script>
main.html
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<script language="JavaScript">
<!--
function init()
{
document.all.doc_html.contents = "kisslan :)";
}
//-->
</script>
</head><body bgcolor="#FFFFFF" onload="init()">
<object id="doc_html" name="doc_html" width=598 height=320 data="edit.html" type="text/x-scriptlet"></object>
</body>
</html>
edit.html
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="javascript">
var targetDoc;
public_description = new editor;
function editor()
{
this.put_contents = PutContents;
}
function PutContents(contents)
{
targetDoc.designMode = "On";
if (target.document.all["cdiv"]!=null) target.document.all["cdiv"].innerHTML = contents;
else target.document.body.innerHTML = contents;
}
</script>
</head>
<body onload="editor()">
<iframe id=target name=target scrolling="yes" marginwidth=1 style="HEIGHT: 100%; WIDTH: 100%">
</iframe>
</script>
</body>
<script>
targetDoc = document.frames.target.document;
targetDoc.designMode = "On";
</script>
"../editor/theMain.html"
=================================================
该页是文字编辑器的主页, 里面也包含一个iframe
<IFRAME id=editor src="theContent.asp?editid=***" frameBorder=0 width="100%" scrolling=yes height="98%"></IFRAME>
我是传递编辑编号直接写的
================================================================
新闻内容:<BR>
<TextArea name="hiddenNewsContent" id="hiddenNewsContent" cols="60" rows="10" style="display:none;">aaaaa</TextArea><iframe src="../editor/theMain.html" width="100%" height="550" frameborder=0 framespacing=0 hspace=0 scrolling=yes id="fm_NewsContent"
onload="javascript:var fm_theContent = this.contentWindow.document.getElementById('editor');fm_theContent.document.body.innerHTML = hiddenNewsContent.value;"></iframe> "../editor/theMain.html"
=================================================
该页是文字编辑器的主页, 里面也包含一个iframe
<IFRAME id=editor src="theContent.html" frameBorder=0 width="100%" scrolling=yes height="98%"></IFRAME>调试结果:新闻内容是赋值进去了,但是却处于不可编辑的状态,designMode = 'On'不行了
说明:theMain.html,theContent.html都可以的,如果传参数id进去
文件相应改成asp文件可以在线编辑的我上面这样写有问题吗?
我用的是:http://www.gy163.cn/temp/editor/editor.htm代码思路:
http://202.101.18.235/club/bbs/showEssence.asp?id=21387大家给个意见吧