编辑控件 editbox.htc
-----------------------------------------------------------------------------
<public:component tagName=editBox>
<public:defaults viewLinkContent/>
</public:component>
<div unselectable="on" align=center style="height:250; width:425; background-color:powderblue; border:outset powderblue">
<br>
<div id=foo contenteditable align=left
style="height:200; width:370;background-color:white; font-face:Arial; padding:3;
border:inset powderblue; scrollbar-base-color:powderblue; overflow=auto;">
</div>
<br>
<button unselectable="On" onclick='document.execCommand("Bold");foo.focus();'
style="background-color:powderblue; border-color:powderblue" title="粗体">
<B>B</B></button>
<button unselectable="On" onclick='document.execCommand("Italic");foo.focus();'
style="background-color:powderblue; border-color:powderblue" title="斜体">
<B><I>I</I></B></button>
<button unselectable="On" onclick='document.execCommand("Underline");foo.focus();'
style="background-color:powderblue; border-color:powderblue;" title="下划线">
<B><U>U</U></B></button>
<button unselectable="On" onclick='document.execCommand("StrikeThrough");foo.focus();'
style="background-color:powderblue; border-color:powderblue; text-decoration=line-through"
title="删除线">
<B>S</B></button>
<button unselectable="On" onclick='document.execCommand("SuperScript");foo.focus();'
style="background-color:powderblue; border-color:powderblue" title="上标">
<B>^</B></button>
<button unselectable="On" onclick='document.execCommand("SubScript");foo.focus();'
style="background-color:powderblue; border-color:powderblue" title="下标">
<B>_</B></button>
<button unselectable="On" onclick='document.execCommand("InsertOrderedList");foo.focus();'
style="background-color:powderblue; border-color:powderblue" title="已排序列表">
<B>OL</B></button>
<button unselectable="On" onclick='document.execCommand("InsertUnorderedList");foo.focus();'
style="background-color:powderblue; border-color:powderblue" title="未排序列表">
<B>UL</B></button>
<button unselectable="On" onclick='document.execCommand("Outdent");foo.focus();'
style="background-color:powderblue; border-color:powderblue" title="突出">
<B><<</B></button>
<button unselectable="On" onclick='document.execCommand("Indent");foo.focus();'
style="background-color:powderblue; border-color:powderblue" title="缩进">
<B>>></B></button>
<button unselectable="On" onclick='document.execCommand("JustifyLeft");foo.focus();'
style="background-color:powderblue; border-color:powderblue" title="左对齐">
<B>|<</B></button>
<button unselectable="On" onclick='document.execCommand("JustifyRight");foo.focus();'
style="background-color:powderblue; border-color:powderblue" title="右对齐">
<B>>|</B></button>
<button unselectable="On" onclick='document.execCommand("JustifyCenter");foo.focus();'
style="background-color:powderblue; border-color:powderblue" title="居中">
<B>>|<</B></button>
<br>
<button unselectable="On" onclick='document.execCommand("Cut");foo.focus();'
style="background-color:powderblue; border-color:powderblue"><B>剪切</B></button>
<button unselectable="On" onclick='document.execCommand("Copy");foo.focus();'
style="background-color:powderblue; border-color:powderblue"><B>复制</B></button>
<button unselectable="On" onclick='document.execCommand("Paste")'
style="background-color:powderblue; border-color:powderblue"><B>粘贴</B></button>
<button unselectable="On" onclick='document.execCommand("Overwrite");foo.focus();'
style="background-color:powderblue; border-color:powderblue"><B>覆盖</B></button>
</div>调用页面editbox.htm
------------------------------------------------------------------------------
<html xmlns:x>
<head>
<title>编辑控件</title>
<?import namespace=x implementation="editBox.htc" />
</head>
<body>
<form>
<table border='0' align='center'>
<tr><td align="center">
<x:editbox ID="EDITBOX" />
</td></tr>
</table>
</form>
</body>
</html>分桢框架
------------------------------------------------------------------
<html>
<head>
<title>分桢</title>
</head>
<frameset cols="100,*" >
<frame src="about:blank" >
<frame src="editbox.htm" >
</frameset>
</html>------------------------------------------------------
将这三个页面保存下来,放于同一目录。运行editbox.htm,一切正常;运行frame.htm,毛病出来了。
-----------------------------------------------------------------------------
<public:component tagName=editBox>
<public:defaults viewLinkContent/>
</public:component>
<div unselectable="on" align=center style="height:250; width:425; background-color:powderblue; border:outset powderblue">
<br>
<div id=foo contenteditable align=left
style="height:200; width:370;background-color:white; font-face:Arial; padding:3;
border:inset powderblue; scrollbar-base-color:powderblue; overflow=auto;">
</div>
<br>
<button unselectable="On" onclick='document.execCommand("Bold");foo.focus();'
style="background-color:powderblue; border-color:powderblue" title="粗体">
<B>B</B></button>
<button unselectable="On" onclick='document.execCommand("Italic");foo.focus();'
style="background-color:powderblue; border-color:powderblue" title="斜体">
<B><I>I</I></B></button>
<button unselectable="On" onclick='document.execCommand("Underline");foo.focus();'
style="background-color:powderblue; border-color:powderblue;" title="下划线">
<B><U>U</U></B></button>
<button unselectable="On" onclick='document.execCommand("StrikeThrough");foo.focus();'
style="background-color:powderblue; border-color:powderblue; text-decoration=line-through"
title="删除线">
<B>S</B></button>
<button unselectable="On" onclick='document.execCommand("SuperScript");foo.focus();'
style="background-color:powderblue; border-color:powderblue" title="上标">
<B>^</B></button>
<button unselectable="On" onclick='document.execCommand("SubScript");foo.focus();'
style="background-color:powderblue; border-color:powderblue" title="下标">
<B>_</B></button>
<button unselectable="On" onclick='document.execCommand("InsertOrderedList");foo.focus();'
style="background-color:powderblue; border-color:powderblue" title="已排序列表">
<B>OL</B></button>
<button unselectable="On" onclick='document.execCommand("InsertUnorderedList");foo.focus();'
style="background-color:powderblue; border-color:powderblue" title="未排序列表">
<B>UL</B></button>
<button unselectable="On" onclick='document.execCommand("Outdent");foo.focus();'
style="background-color:powderblue; border-color:powderblue" title="突出">
<B><<</B></button>
<button unselectable="On" onclick='document.execCommand("Indent");foo.focus();'
style="background-color:powderblue; border-color:powderblue" title="缩进">
<B>>></B></button>
<button unselectable="On" onclick='document.execCommand("JustifyLeft");foo.focus();'
style="background-color:powderblue; border-color:powderblue" title="左对齐">
<B>|<</B></button>
<button unselectable="On" onclick='document.execCommand("JustifyRight");foo.focus();'
style="background-color:powderblue; border-color:powderblue" title="右对齐">
<B>>|</B></button>
<button unselectable="On" onclick='document.execCommand("JustifyCenter");foo.focus();'
style="background-color:powderblue; border-color:powderblue" title="居中">
<B>>|<</B></button>
<br>
<button unselectable="On" onclick='document.execCommand("Cut");foo.focus();'
style="background-color:powderblue; border-color:powderblue"><B>剪切</B></button>
<button unselectable="On" onclick='document.execCommand("Copy");foo.focus();'
style="background-color:powderblue; border-color:powderblue"><B>复制</B></button>
<button unselectable="On" onclick='document.execCommand("Paste")'
style="background-color:powderblue; border-color:powderblue"><B>粘贴</B></button>
<button unselectable="On" onclick='document.execCommand("Overwrite");foo.focus();'
style="background-color:powderblue; border-color:powderblue"><B>覆盖</B></button>
</div>调用页面editbox.htm
------------------------------------------------------------------------------
<html xmlns:x>
<head>
<title>编辑控件</title>
<?import namespace=x implementation="editBox.htc" />
</head>
<body>
<form>
<table border='0' align='center'>
<tr><td align="center">
<x:editbox ID="EDITBOX" />
</td></tr>
</table>
</form>
</body>
</html>分桢框架
------------------------------------------------------------------
<html>
<head>
<title>分桢</title>
</head>
<frameset cols="100,*" >
<frame src="about:blank" >
<frame src="editbox.htm" >
</frameset>
</html>------------------------------------------------------
将这三个页面保存下来,放于同一目录。运行editbox.htm,一切正常;运行frame.htm,毛病出来了。
解决方案 »
- jquery 关于 hover 时触发setTimeout 并执行函数 求高手指教!
- 怎样用jQuery获取表单中的值并赋给数组?
- Jquery1.4 鼠标移上去行不能变色
- input框焦点赋不上去
- 关于图片在页面进行斜向滚动的问题?(急!)
- 为什么我用indexof提示我不支持该属性或方法?
- 正则表达式遇到问题了,希望高手解决啊!!
- 在网页中如何实现下载一个文件的功能
- <iframe>的时候怎么控制被<iframe>页面不能弹出右键
- 敢问各位高手,WScript.Shell是不是可以打开任何可执行文件呢?
- 给大家一个日起输入的控件——可以减少客户端输入错误呀
- str = str.replace(/a/g, "abc");是什么意思啊
rng.move("textedit");
rng.select();
document.Form1.txt1.focus();则在这个编辑控件里,DEL键就可以使用,但又不完全正常,比如你选定一块,按DEL,常理应该是选定的块全删掉,但现在是一个字一个字地删,一次删一个。