<div align=left id=App style="background-color:#F7F7F7;height:380px;overflow:auto;width:100%;z-index:2" contentEditable></div>
<iframe contentEditable></iframe>
<iframe contentEditable></iframe>
解决方案 »
- JS幻灯片显示问题啊
- 怎样在鼠标进入热区时热区显示一个反白的边框?
- jquery.nyroModal插件
- 网页右边跟随滚动条上下移动的小广告
- 怎样得到文本结点的文本类容
- 100求救!如何让鼠标移动到一张图片上时候图片变成另一张移开后又恢复原来的图片
- Cookies问题
- onmousemove和onmouseover有什么区别,onmouseleave和onmouseout又有什么区别?
- js功能强,使用方便!
- JavaScript的继承属性遍历的问题
- 难题挑战之一:如何使在Frame中alert出的消息框相对于Frame居中而不是相对整个浏览器窗口居中
- 怎样判断文本输入框中的字符串是否符合日期格式?
targetDoc = document.frames(0).document;
if (targetDoc.designMode == "On")
targetDoc.designMode = "Off";
else
targetDoc.designMode = "On";
</script>
<button id=btnDesign>DesignMode</button>
<iframe src="blank.htm" style="border: black thin; width:100%; height:200px"></iframe>
<html>
<body onload="editer.document.designMode='On'">
<IFrame ID="editer"></IFrame>
</body>
</html>
其中designMode属性表示IFrame的设计模式的状态(开/关),还在犹豫什么呢,快试试吧!
只要巧妙的利用这一特性就可以制作很多意想不到的效果。如果下面我们来做一个图片编辑器。
<html>
<body onload="imgEditer.document.designMode='On';imgEditer.document.write('<img src=图片.gif>')">
<IFrame id="imgEditer"></IFrame>
</body>
</html>
用鼠标点击图片是不是有新的发现,其实大家只要利用自己的想象和充分利用这个属性一定能做出更多的花样来,别忘了到时候有什么新的东东,告诉我一声呀!(Email:[email protected])
想在iframe里显示纯文本,就像在textarea里一模一样,帮帮我!
1.希望注释也能显示出来
2.希望换行能显示出来
看看这个htm的源代码,挺nb的
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>ubb编辑器</title>
<link href="../../css/snowkiss.css" rel="stylesheet" type="text/css">
</head>
<body>
<div align="center">
<table width="450" height="100" cellpadding="4" cellspacing="0">
<tr align="center">
<td width="80" style="border:dotted 1px"><a href="#" onClick="execCmd('SelectAll')">SelectAll</a></td>
<td width="80" style="border:dotted 1px"><a href="#" onClick="execCmd('bold')">Bold</a></td>
<td width="80" style="border:dotted 1px"><a href="#" onClick="execCmd('Italic')">Italic</a></td>
<td width="80" style="border:dotted 1px"><a href="#" onClick="execCmd('underline')">Underline</a></td>
<td width="80" style="border:dotted 1px"><a href="#" onClick="execCmd('cut')">Cut</a></td>
<td width="80" style="border:dotted 1px"><a href="#" onClick="execCmd('Paste')">Paste</a></td>
</tr>
<tr>
<td colspan="6" style="border:dotted 1px"><iframe align="middle" width="100%" height="100%" marginheight="0" marginwidth="0" frameborder="0" id="Editor"></iframe></td>
</tr>
</table>
</div>
</body>
</html>
<script language="JavaScript">
//初始化编辑器
Editor.document.designMode="On";
Editor.document.open ;
Editor.document.write ("<!--请选中这些文字,并点上面的链接看看效果!!!-->用的iframe,挺牛的,但还不理想,注释中的文字没了!");
Editor.document.close ;
Editor.focus();
//初始化结束
function execCmd(CmdIdentifiers)
{
Editor.document.execCommand(CmdIdentifiers);
return(true);
}
</script>