比如我在一个表格中放置了一个html编辑器,怎么把数据库的取出到放到html编辑器
中显示?
---------------------------------------------------------------
1<object data="/include/RichEditor/editor_01.htm" height="300" id="msg" style="display:block" type="text/x-scriptlet" viewastext="" width="100%">
2这么包括进去,data指向的就是那个包括html编辑器的对象
3赋值用
4document.all.msg.value="内容"
5
6\---------------------------------------------------------------
7
8你的那个对象,有没有value这个属性的呀,必须有这个属性的哟
9
10\---------------------------------------------------------------
11
12那它是不是可写的呀,
13属性有可写不与可写之分的呀
14你自己研究一下它的源程序的呀,
15又不是很难的
16
17\---------------------------------------------------------------
18
191、将下面的代码放在head区中
20<script language="javascript">
21<!--
22function abc()
23{
24document.form1.doc_html.value = document.form1.cont.value
25
26return true
27}
28function CheckForm()
29{
30document.form1.content.value=document.form1.doc_html.value;
31
32return true
33}
34
35//-->
36</script>
37
382、<body onload="javascript:abc()">
39将数据库中的记录保存在另外一个textarea中,并赋值给编辑器
40
413、下面是表单的部分细节,利用onsubmit动作将修改后的html代码赋值给隐藏的content,为存入数据库做好资准备。```
42=content
43```从数据库中取出记录:
44<form action="......" method="POST" name="form1" onsubmit="return CheckForm()">
45...............
46<object data="editor.htm" height="320" id="doc_html" style="LEFT: 0px; TOP: 0px" type="text/x-scriptlet" viewastext="" width="544">
47<embed height="320" src="editor.htm" width="544"/>
48</object>
49...............
50<textarea name="cont" style="display:none">
=content
1</textarea>
2<input name="content" type="hidden" value=""/>
3
4
5以上是测试成功的代码</form></body></object>