通信人家园

 找回密码
 注册

只需一步,快速开始

短信验证,便捷登录

搜索
查看: 2825|回复: 0
打印

用htc实现html编辑器 [复制链接]

军衔等级:

  元帅

注册:2006-6-22

爱心徽章,06年为希望小学奉献爱心纪念徽章

跳转到指定楼层
1#
发表于 2006-10-10 13:23:00 |只看该作者 |倒序浏览
HTC,全称为HTML Component,提供了在网页中用脚本进行组件开发的机制。下面的代码,在页面中嵌入一个html编辑器,只需要几行代码,只因为使用了一个预先定义好的html编辑组件。html编辑组件定义在文件"htmleditor.htc"中,使用的是javascript脚本。这个组件来自于一个免费软件:书包行CuteIE(一款用浏览器形式实现的多功能、可无限扩充的个人信息助理软件),如果程序安装在D盘的话,那么这个组件文件的路径是D:\Program Files\CuteIE\System\inc\cuteie_client\1_0\htmleditor.htc。

如果要将此组件使用在自己的网站中,只需要将组件文件htmleditor.htc和图片目录images放置到自己的网站目录下,然后修改下面代码中的相关路径指向(如IMPLEMENTATION、SystemImagesPath)即可。

<?XML:NAMESPACE PREFIX=HENS />
<?IMPORT NAMESPACE=HENS IMPLEMENTATION="/inc/cuteie_client/1_0/htmleditor.htc"/>

<hens:htmleditor id="htmleditor1" SystemImagesPath="/inc/cuteie_client/1_0/images/" width=100% height=400></hens:htmleditor>

<script language=javascript>
//提取html编辑器的内容,只需要以下代码即可。
var oContent=htmleditor1.content;
</script>

相关资源:
书包行CuteIE下载地址:http://www.cuteie.com/CuteIESetup.exe
官方网站:http://www.cuteie.com/

由于htmleditor.htc代码比较长,下面仅摘录组件的属性、事件定义部分。

<public:component tagname=htmleditor literalcontent=true>
<public:attach event=oncontentready onevent="oncontentready()" />
<public:property name="systemImagesPath" id="_hepropSystemImagesPath" GET="getSystemImagesPath" PUT="setSystemImagesPath"/>
<public:property name="content" id="_hepropContent" GET="getContent" PUT="setContent"/>
<public:property name="contentType" id="_hepropContentType" GET="getContentType" PUT="setContentType"/>
<public:event name="onblur" id="_heevtBlur"/>
</public:component>





Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=446392

举报本楼

您需要登录后才可以回帖 登录 | 注册 |

版规|手机版|C114 ( 沪ICP备12002291号-1 )|联系我们 |网站地图  

GMT+8, 2025-11-4 08:21 , Processed in 0.088829 second(s), 18 queries , Gzip On.

Copyright © 1999-2025 C114 All Rights Reserved

Discuz Licensed

回顶部