inicio mail me! sindicaci;ón

How to use HTC file to enclose CSS style

The course that the HTC that founds highlight of glide of a mouse to show will come to demonstrate to found HTC is passed below. 1, the framework that establishs HTC file. The HTC file of a standard contains a SCRIPT piece with a pair optional COMPONENT labels.

<PUBLIC:COMPONENT>

<SCRIPT>

</SCRIPT>

</PUBLIC:COMPONENT>

2, write an executable script.

  

In the code below, ATTACH is used at installing HTC to receive the information that the element is sparked in incident of Onmouseover and Onmouseout. It informs the highlight when HTC reflects mouse glide element through switch color of the effect.

<PUBLIC:COMPONENT>

<PUBLIC:ATTACH EVENT= “onmouseover” ONEVENT= “Hilite()” />

<PUBLIC:ATTACH EVENT= “onmouseout” ONEVENT= “Restore()” />

<SCRIPT LANGUAGE= "JScript ">Var NormalColor, normalSpacing;Function Hilite()

{

/ / Save Original ValuesNormalColor = RuntimeStyle.color; NormalSpacing= RuntimeStyle.letterSpacing;RuntimeStyle.color = “red” ;RuntimeStyle.letterSpacing = 2;

}Function Restore()

{

/ / Restore Original ValuesRuntimeStyle.color = NormalColor;RuntimeStyle.letterSpacing = NormalSpacing;

}

</SCRIPT>

</PUBLIC:COMPONENT>

Will above save for Hilite.htc file.

Attention: You can use attribute, method directly or the name of incident will visit them, do not need to add the prefix of Element in front. We notice when switch color we called RuntimeStyle directly in the example in front, is not use Element.runtimeStyle.

3, once carry out, this HTC can achieve the result of mouse glide highlight in the application in the webpage.

<HEAD>

<STYLE>

LI {behavior:uRl(hilite.htc)}

</STYLE>

</HEAD>

<P>Mouse Over The Two List Items Below To See This Effect.

<UL>

</LI of station of <LI> China stationmaster>

<LI>www.chinaz.com</LI>

</UL>

Bookmark:Digg Del.icio.us Reddit

Leave a Comment