代码继续,直接接着上面的代码复制就可用
<TD class=ico4> </TD>
<TD style="FONT-SIZE: 12px"> </TD>
<TD style="FONT-SIZE: 12px" width="60"><INPUT language=javascript
onmouseover=fSetModeTip(this) onclick=setMode(this.checked)
onmouseout=fHideTip() type=checkbox name=switchMode> HTML</TD>
<TD width="20"><IMG src="htmlEdit.files/editor_s.gif"></TD>
<TD style="FONT-SIZE: 12px"><IMG onmousedown=fSetBorderMouseDown(this)
onmouseover=fSetBorderMouseOver(this) title=增加文本框 onclick=doInsertInputRadio()
onmouseout=fSetBorderMouseOut(this) height=20
src="htmlEdit.files/editor_radio.gif" width=21></TD>
<TD style="FONT-SIZE: 12px"><IMG onmousedown=fSetBorderMouseDown(this)
onmouseover=fSetBorderMouseOver(this) title=增加文本框 onclick=doInsertInputText()
onmouseout=fSetBorderMouseOut(this) height=20
src="htmlEdit.files/editor_text.gif" width=21></TD>
</TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<DIV id=dvForeColor
style="DISPLAY: none; LEFT: -500px; WIDTH: 100px; POSITION: absolute; TOP: -500px; HEIGHT: 100px">
<TABLE style="BORDER-RIGHT: #888888 1px solid; BORDER-TOP: #888888 1px solid; BORDER-LEFT: #888888 1px solid; BORDER-BOTTOM: #888888 1px solid"
height=25 cellSpacing=0 cellPadding=0 width=218>
<TBODY>
<TR>
<TD id=tdView width=110> </TD>
<TD id=tdColorCode align=middle bgColor=#ffffff></TD></TR></TBODY></TABLE></DIV>
<DIV id=dvPortrait style="DISPLAY: none; LEFT: -500px; WIDTH: 100px; POSITION: absolute; TOP: -500px; HEIGHT: 100px"></DIV>
<DIV id=fontface style="BORDER-RIGHT: #838383 1px solid; PADDING-RIGHT: 1px; BORDER-TOP: #838383 1px solid; DISPLAY: none; PADDING-LEFT: 1px; Z-INDEX: 99; BACKGROUND: #ffffff; LEFT: 2px; PADDING-BOTTOM: 1px; BORDER-LEFT: #838383 1px solid; WIDTH: 110px; PADDING-TOP: 1px; BORDER-BOTTOM: #838383 1px solid; POSITION: absolute; TOP: 35px; HEIGHT: 270px">
<A class=n style="FONT: 12px '宋体'"
onclick="format('fontname',this.innerHTML);this.parentNode.style.display='none'"
href="javascript:void(0)">宋体</A><A class=n style="FONT: 12px '黑体'"
onclick="format('fontname',this.innerHTML);this.parentNode.style.display='none'"
href="javascript:void(0)">黑体</A><A class=n style="FONT: 12px '楷体'"
onclick="format('fontname',this.innerHTML);this.parentNode.style.display='none'"
href="javascript:void(0)">楷体</A><A class=n style="FONT: 12px '隶书'"
onclick="format('fontname',this.innerHTML);this.parentNode.style.display='none'"
href="javascript:void(0)">隶书</A><A class=n style="FONT: 12px '幼圆'"
onclick="format('fontname',this.innerHTML);this.parentNode.style.display='none'"
href="http://www.e077.com/html/###">幼圆</A><A class=n style="FONT: 12px Arial"
onclick="format('fontname',this.innerHTML);this.parentNode.style.display='none'"
href="http://www.e077.com/html/###">Arial</A><A class=n
style="FONT: 12px 'Arial Narrow'"
onclick="format('fontname',this.innerHTML);this.parentNode.style.display='none'"
href="http://www.e077.com/html/###">Arial Narrow</A><A class=n
style="FONT: 12px 'Arial Black'"
onclick="format('fontname',this.innerHTML);this.parentNode.style.display='none'"
href="http://www.e077.com/html/###">Arial Black</A><A class=n
style="FONT: 12px 'Comic Sans MS'"
onclick="format('fontname',this.innerHTML);this.parentNode.style.display='none'"
href="http://www.e077.com/html/###">Comic Sans MS</A><A class=n
style="FONT: 12px Courier"
onclick="format('fontname',this.innerHTML);this.parentNode.style.display='none'"
href="http://www.e077.com/html/###">Courier</A><A class=n
style="FONT: 12px System"
onclick="format('fontname',this.innerHTML);this.parentNode.style.display='none'"
href="http://www.e077.com/html/###">System</A><A class=n
style="FONT: 12px 'Times New Roman'"
onclick="format('fontname',this.innerHTML);this.parentNode.style.display='none'"
href="javascript:void(0)">Times New Roman</A><A class=n
style="FONT: 12px Verdana"
onclick="format('fontname',this.innerHTML);this.parentNode.style.display='none'"
href="javascript:void(0)">Verdana</A></DIV>
<DIV id=fontsize
style="BORDER-RIGHT: #838383 1px solid; PADDING-RIGHT: 1px; BORDER-TOP: #838383 1px solid; DISPLAY: none; PADDING-LEFT: 1px; BACKGROUND: #ffffff; LEFT: 26px; PADDING-BOTTOM: 1px; BORDER-LEFT: #838383 1px solid; WIDTH: 115px; PADDING-TOP: 1px; BORDER-BOTTOM: #838383 1px solid; POSITION: absolute; TOP: 35px; HEIGHT: 160px"><A
class=n style="FONT-SIZE: xx-small; LINE-HEIGHT: 120%"
onclick="format('fontsize',1);this.parentNode.style.display='none'"
href="javascript:void(0)">极小</A><A class=n
style="FONT-SIZE: x-small; LINE-HEIGHT: 120%"
onclick="format('fontsize',2);this.parentNode.style.display='none'"
href="javascript:void(0)">特小</A><A class=n
style="FONT-SIZE: small; LINE-HEIGHT: 120%"
onclick="format('fontsize',3);this.parentNode.style.display='none'"
href="javascript:void(0)">小</A><A class=n
style="FONT-SIZE: medium; LINE-HEIGHT: 120%"
onclick="format('fontsize',4);this.parentNode.style.display='none'"
href="http://www.e077.com/html/##">中</A><A class=n
style="FONT-SIZE: large; LINE-HEIGHT: 120%"
onclick="format('fontsize',5);this.parentNode.style.display='none'"
href="javascript:void(0)">大</A><A class=n
style="FONT-SIZE: x-large; LINE-HEIGHT: 120%"
onclick="format('fontsize',6);this.parentNode.style.display='none'"
href="javascript:void(0)">特大</A><A class=n
style="FONT-SIZE: xx-large; LINE-HEIGHT: 140%"
onclick="format('fontsize',7);this.parentNode.style.display='none'"
href="javascript:void(0)">极大</A></DIV>
<DIV id=divEditor>
<table width="100%" height:287px border="0" cellspacing="0" cellpadding="0" >
<tr><td style="border:1px solid #C5C5C5; border-top:0;">
<IFRAME class="HtmlEditor" ID="HtmlEditor" name="HtmlEditor"
style="height:286px;width:100%" frameBorder="2" marginHeight=0 marginWidth=0></IFRAME></td>
</tr>
</table>
</DIV>
<input type = button value="点我" onclick= test() >
<SCRIPT language=JavaScript>
function test(){
//var node = document.getElementById("HtmlEditor");
//var html = node.innerHTML
}
<!--
if(document.all){
document.write('<textarea ID="sourceEditor" style="height:280px;width:100%;display:none">');
}else{
document.write('<textarea ID="sourceEditor" style="height:282px;width:100%;display:none">');
}
//-->
</SCRIPT>
</BODY></HTML>
<TD class=ico4> </TD>
<TD style="FONT-SIZE: 12px"> </TD>
<TD style="FONT-SIZE: 12px" width="60"><INPUT language=javascript
onmouseover=fSetModeTip(this) onclick=setMode(this.checked)
onmouseout=fHideTip() type=checkbox name=switchMode> HTML</TD>
<TD width="20"><IMG src="htmlEdit.files/editor_s.gif"></TD>
<TD style="FONT-SIZE: 12px"><IMG onmousedown=fSetBorderMouseDown(this)
onmouseover=fSetBorderMouseOver(this) title=增加文本框 onclick=doInsertInputRadio()
onmouseout=fSetBorderMouseOut(this) height=20
src="htmlEdit.files/editor_radio.gif" width=21></TD>
<TD style="FONT-SIZE: 12px"><IMG onmousedown=fSetBorderMouseDown(this)
onmouseover=fSetBorderMouseOver(this) title=增加文本框 onclick=doInsertInputText()
onmouseout=fSetBorderMouseOut(this) height=20
src="htmlEdit.files/editor_text.gif" width=21></TD>
</TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<DIV id=dvForeColor
style="DISPLAY: none; LEFT: -500px; WIDTH: 100px; POSITION: absolute; TOP: -500px; HEIGHT: 100px">
<TABLE style="BORDER-RIGHT: #888888 1px solid; BORDER-TOP: #888888 1px solid; BORDER-LEFT: #888888 1px solid; BORDER-BOTTOM: #888888 1px solid"
height=25 cellSpacing=0 cellPadding=0 width=218>
<TBODY>
<TR>
<TD id=tdView width=110> </TD>
<TD id=tdColorCode align=middle bgColor=#ffffff></TD></TR></TBODY></TABLE></DIV>
<DIV id=dvPortrait style="DISPLAY: none; LEFT: -500px; WIDTH: 100px; POSITION: absolute; TOP: -500px; HEIGHT: 100px"></DIV>
<DIV id=fontface style="BORDER-RIGHT: #838383 1px solid; PADDING-RIGHT: 1px; BORDER-TOP: #838383 1px solid; DISPLAY: none; PADDING-LEFT: 1px; Z-INDEX: 99; BACKGROUND: #ffffff; LEFT: 2px; PADDING-BOTTOM: 1px; BORDER-LEFT: #838383 1px solid; WIDTH: 110px; PADDING-TOP: 1px; BORDER-BOTTOM: #838383 1px solid; POSITION: absolute; TOP: 35px; HEIGHT: 270px">
<A class=n style="FONT: 12px '宋体'"
onclick="format('fontname',this.innerHTML);this.parentNode.style.display='none'"
href="javascript:void(0)">宋体</A><A class=n style="FONT: 12px '黑体'"
onclick="format('fontname',this.innerHTML);this.parentNode.style.display='none'"
href="javascript:void(0)">黑体</A><A class=n style="FONT: 12px '楷体'"
onclick="format('fontname',this.innerHTML);this.parentNode.style.display='none'"
href="javascript:void(0)">楷体</A><A class=n style="FONT: 12px '隶书'"
onclick="format('fontname',this.innerHTML);this.parentNode.style.display='none'"
href="javascript:void(0)">隶书</A><A class=n style="FONT: 12px '幼圆'"
onclick="format('fontname',this.innerHTML);this.parentNode.style.display='none'"
href="http://www.e077.com/html/###">幼圆</A><A class=n style="FONT: 12px Arial"
onclick="format('fontname',this.innerHTML);this.parentNode.style.display='none'"
href="http://www.e077.com/html/###">Arial</A><A class=n
style="FONT: 12px 'Arial Narrow'"
onclick="format('fontname',this.innerHTML);this.parentNode.style.display='none'"
href="http://www.e077.com/html/###">Arial Narrow</A><A class=n
style="FONT: 12px 'Arial Black'"
onclick="format('fontname',this.innerHTML);this.parentNode.style.display='none'"
href="http://www.e077.com/html/###">Arial Black</A><A class=n
style="FONT: 12px 'Comic Sans MS'"
onclick="format('fontname',this.innerHTML);this.parentNode.style.display='none'"
href="http://www.e077.com/html/###">Comic Sans MS</A><A class=n
style="FONT: 12px Courier"
onclick="format('fontname',this.innerHTML);this.parentNode.style.display='none'"
href="http://www.e077.com/html/###">Courier</A><A class=n
style="FONT: 12px System"
onclick="format('fontname',this.innerHTML);this.parentNode.style.display='none'"
href="http://www.e077.com/html/###">System</A><A class=n
style="FONT: 12px 'Times New Roman'"
onclick="format('fontname',this.innerHTML);this.parentNode.style.display='none'"
href="javascript:void(0)">Times New Roman</A><A class=n
style="FONT: 12px Verdana"
onclick="format('fontname',this.innerHTML);this.parentNode.style.display='none'"
href="javascript:void(0)">Verdana</A></DIV>
<DIV id=fontsize
style="BORDER-RIGHT: #838383 1px solid; PADDING-RIGHT: 1px; BORDER-TOP: #838383 1px solid; DISPLAY: none; PADDING-LEFT: 1px; BACKGROUND: #ffffff; LEFT: 26px; PADDING-BOTTOM: 1px; BORDER-LEFT: #838383 1px solid; WIDTH: 115px; PADDING-TOP: 1px; BORDER-BOTTOM: #838383 1px solid; POSITION: absolute; TOP: 35px; HEIGHT: 160px"><A
class=n style="FONT-SIZE: xx-small; LINE-HEIGHT: 120%"
onclick="format('fontsize',1);this.parentNode.style.display='none'"
href="javascript:void(0)">极小</A><A class=n
style="FONT-SIZE: x-small; LINE-HEIGHT: 120%"
onclick="format('fontsize',2);this.parentNode.style.display='none'"
href="javascript:void(0)">特小</A><A class=n
style="FONT-SIZE: small; LINE-HEIGHT: 120%"
onclick="format('fontsize',3);this.parentNode.style.display='none'"
href="javascript:void(0)">小</A><A class=n
style="FONT-SIZE: medium; LINE-HEIGHT: 120%"
onclick="format('fontsize',4);this.parentNode.style.display='none'"
href="http://www.e077.com/html/##">中</A><A class=n
style="FONT-SIZE: large; LINE-HEIGHT: 120%"
onclick="format('fontsize',5);this.parentNode.style.display='none'"
href="javascript:void(0)">大</A><A class=n
style="FONT-SIZE: x-large; LINE-HEIGHT: 120%"
onclick="format('fontsize',6);this.parentNode.style.display='none'"
href="javascript:void(0)">特大</A><A class=n
style="FONT-SIZE: xx-large; LINE-HEIGHT: 140%"
onclick="format('fontsize',7);this.parentNode.style.display='none'"
href="javascript:void(0)">极大</A></DIV>
<DIV id=divEditor>
<table width="100%" height:287px border="0" cellspacing="0" cellpadding="0" >
<tr><td style="border:1px solid #C5C5C5; border-top:0;">
<IFRAME class="HtmlEditor" ID="HtmlEditor" name="HtmlEditor"
style="height:286px;width:100%" frameBorder="2" marginHeight=0 marginWidth=0></IFRAME></td>
</tr>
</table>
</DIV>
<input type = button value="点我" onclick= test() >
<SCRIPT language=JavaScript>
function test(){
//var node = document.getElementById("HtmlEditor");
//var html = node.innerHTML
}
<!--
if(document.all){
document.write('<textarea ID="sourceEditor" style="height:280px;width:100%;display:none">');
}else{
document.write('<textarea ID="sourceEditor" style="height:282px;width:100%;display:none">');
}
//-->
</SCRIPT>
</BODY></HTML>
解决方案 »
- ff中,return false不起作用?
- 如何编写批量效果的代码,急用!
- 这段简单的代码到底哪里错了??
- 【求帮助】window.event.returnvalue=false;不起作用
- 请教高手,对象调用数组的方法?
- 用window.open()方法打开的新窗口,如何将其设置为"模态"窗口,即如果不关闭此窗口,就无法对其他窗口进行操作
- netscape7.0下的children?
- 请问javascrpt如何取得网址中?后面所带的参数?
- 在文本框如何判断第一个字符为“s”如果是S返回之后的所有字符?
- Extjs5.0 Chart问题
- 关于javascript中document.write的写法。。。。大家帮一下忙
- JavaScript 中RemoveAll 函数的用法问题
function testwts(){
document.getElementById("aim").value=HtmlEditor.document.body.innerHTML;
alert(HtmlEditor.document.body.innerHTML);}
</script>
<input type = button value="点我" onclick= testwts() >
<textarea id="aim">
</textarea>HtmlEditor.document.body.innerHTML这句如果不行就改成document.getElementById("HtmlEditor").document.body.innerHTML;
<input type = button value="点我" onclick="testwts();" >
alert("内容不能为空!");
return false;
}<textarea name="Content" style="display:none"></textarea>
<iframe ID="eWebEditor1" src="editor.asp?id=Content&style=news&originalfilename=d_originalfilename&savefilename=d_savefilename&savepathfilename=d_savepathfilename" frameborder="0" scrolling="no" width="100%" HEIGHT="360"></iframe>
var html;
if((sCurrMode=="EDIT")||(sCurrMode=="VIEW")){
html = eWebEditor.document.body.innerHTML;
}else{
html = eWebEditor.document.body.innerText;
}
if (sCurrMode!="TEXT"){
if ((html.toLowerCase()=="<p> </p>")||(html.toLowerCase()=="<p></p>")){
html = "";
}
}
return html;
}
<input type="hidden" name="editor"/><!---加个隐藏控件来获取编辑器中的代码,服务器就获取这个控件的值---->
<iframe src='editor.html' id="Editor"></iframe><!-----假设编辑器为editor.html----->
</form>
<script>
function CopyData(f)
{
var ct=document.getElementById("Editor").HtmlEditor.document.body.innerHTML;//获取frame中的编辑器内容
f.editor.value=ct;
}
</script>
不过这个hidden能容纳多大的内容啊,html代码好像有点长哦
你的form是post时没问题,可以容纳
看看这个吧
如同12楼所说的那样form method="post" action="要提交到的页面" onsubmit="CopyData(this);"><!--提交时执行内容复制-->
<input type="hidden" name="editor"/><!---加个隐藏控件来获取编辑器中的代码,服务器就获取这个控件的值---->
<iframe src='editor.html' id="Editor"></iframe><!-----假设编辑器为editor.html----->
</form>
<script>
function CopyData(f)
{
var ct=document.getElementById("Editor").HtmlEditor.document.body.innerHTML;//获取frame中的编辑器内容
f.editor.value=ct;
}
</script>我试过了它的方法,1.html不能获得editor.html里面的编辑的内容?
你能给我正确的吗,我看的有点糊涂
如果 你想在调用该在线编辑器的 页面中 改动尽可能少的话就用setInterval
如果 你只是在少量的页面中使用了该在线编辑器的话在submit事件中添加一下就可以了
var ct=document.getElementById("Editor").HtmlEditor.document.body.innerHTML;
报错啊,你试了吗?可能还是那里有问题啊。。