用htc实现html编辑器

王朝html/css/js·作者佚名  2006-01-10
宽屏版  字体: |||超大  

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>

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
© 2005- 王朝网络 版权所有