社区
JavaScript
帖子详情
HTML编辑控件在分桢情况下DEL键失效的问题。
左直拳
博客专家认证
2004-08-12 11:59:41
我将HTML编辑控件做成了HTC,嵌在网页里调用。如果这个控件所在的网页不是一个分桢的话,就什么问题都没有,但如果是一个分桢,则DEL键,按鼠标右键弹出的菜单中的复制、粘贴通通失效。我将MSDN帮助中的HTML编辑控件(也是HTC)复制过来,问题依旧。查找了很久,都没办法解决,请高手赐教!
...全文
263
7
打赏
收藏
HTML编辑控件在分桢情况下DEL键失效的问题。
我将HTML编辑控件做成了HTC,嵌在网页里调用。如果这个控件所在的网页不是一个分桢的话,就什么问题都没有,但如果是一个分桢,则DEL键,按鼠标右键弹出的菜单中的复制、粘贴通通失效。我将MSDN帮助中的HTML编辑控件(也是HTC)复制过来,问题依旧。查找了很久,都没办法解决,请高手赐教!
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
7 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
BlueDestiny
2004-08-19
打赏
举报
回复
关注
风流才子
2004-08-19
打赏
举报
回复
我也来关注一下
LxcJie
2004-08-12
打赏
举报
回复
嗯,楼主分析的有道理,可能是htc的一个bug,给你顶上去,等着高手来解答
左直拳
2004-08-12
打赏
举报
回复
估计是HTC的问题。因为编辑控件如果不做成HTC的形式,而单纯作为页面的一部分,那么不管这个页面是否为分桢,多少重的分桢,都没有丝毫的问题!
但假如是HTC的问题,难道微软那帮高手不知道吗?就没有一点办法解救吗?
我怀疑是在分桢情况下,可能桢页面的某些操作或消息被屏蔽了。我无意中发现,如果调用HTC的页面还有一些文本框,比如 <input type=text name=txt1>,那么采用如下方法,就会部分地纠正上述问题:
var rng = document.Form1.txt1.createTextRange();
rng.move("textedit");
rng.select();
document.Form1.txt1.focus();
则在这个编辑控件里,DEL键就可以使用,但又不完全正常,比如你选定一块,按DEL,常理应该是选定的块全删掉,但现在是一个字一个字地删,一次删一个。
LxcJie
2004-08-12
打赏
举报
回复
呵呵,挺有意思的,不过找不到哪里的毛病,是不是浏览器本身或者htc本身的问题,帮你顶吧
左直拳
2004-08-12
打赏
举报
回复
编辑控件 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,毛病出来了。
LxcJie
2004-08-12
打赏
举报
回复
把部分代码贴一些看看吧
基于hhww改进版的传统五笔输入法(新版支持WIN7)
改为右Shift
键
问题
: 要修改两处:2A -->> 36 :73914DA8 807D122A cmp byte ptr [ebp+12], 2A :73914DE0 807D122A cmp byte ptr [ebp+12], 2A ============================== 修改为两shift切換: 122A --->>> 0...
基于hhww改进版的传统五笔输入法
改为右Shift
键
问题
: 要修改两处:2A -->> 36 :73914DA8 807D122A cmp byte ptr [ebp+12], 2A :73914DE0 807D122A cmp byte ptr [ebp+12], 2A ============================== 修改为两shift切換: 122A --->>> 0...
Android界面
控件
难点精讲
在Android开发中,如果能够使用MVC模式进行开发,则开发效率会高很多,此时,我们则可以使用AdapterView与Adapter高级
控件
来实现类似MVC的模式进行开发,从而大大提高开发效率本课中会给出AdapterView与Adapter的...
ASP框架AspBox 1.3.2a
新增 AB.Cache.
Del
方法, 别名 AB.Cache(cacheName).
Del
或 AB.Cache.Item(cacheName).
Del
移除 AB.Json.xJSObjectToString, AB.Json.xJSArrayToString 方法 新增 AB.E.encodeURIComponent, AB.E....
GridView
控件
的“
编辑
”,“删除”不可用的
问题
GridView
控件
的“
编辑
”,“删除”不可用的
问题
原因:页面中可能含有标签,使GridView变成文本数据,失去“
编辑
”,“删除”的功能。 解决办法:将的功能用代替。 错误案例: Shopping.aspx asp:GridView ID=...
JavaScript
87,907
社区成员
224,614
社区内容
发帖
与我相关
我的任务
JavaScript
Web 开发 JavaScript
复制链接
扫一扫
分享
社区描述
Web 开发 JavaScript
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章