HTC的入门实例(原创)
test.htm
test.htc
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>test</title>
<style type="text/css">
<!--
div { behavior:url('test.htc')}
-->
</style>
</head>
<body>
<div align="left" Text="bbbbbb" onMouseOver="Hill()">test</div>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>test</title>
<style type="text/css">
<!--
div { behavior:url('test.htc')}
-->
</style>
</head>
<body>
<div align="left" Text="bbbbbb" onMouseOver="Hill()">test</div>
</body>
</html>
test.htc
<public:attach event="onclick" onevent="fun()" />
<public:property name="Text" get="GetText" put="SetText" />
<public:method name="Hill" internalname="f_Hill" />
<script language="JavaScript" type="text/javascript">
function fun()
{
alert(Text);
}
function GetText()
{
return element.innerHTML;
}
function SetText(value)
{
element.innerHTML=value;
}
function f_Hill()
{
element.style.fontSize="24px";
}
element.style.color="#FF0000";
element.style.fontSize="12px";
</script>
<public:property name="Text" get="GetText" put="SetText" />
<public:method name="Hill" internalname="f_Hill" />
<script language="JavaScript" type="text/javascript">
function fun()
{
alert(Text);
}
function GetText()
{
return element.innerHTML;
}
function SetText(value)
{
element.innerHTML=value;
}
function f_Hill()
{
element.style.fontSize="24px";
}
element.style.color="#FF0000";
element.style.fontSize="12px";
</script>