|          
认识Behavior:"Behavior"是IE5内在的功能,可以让网页的不同元件,同时套用同一种动态的变换效果,
 在一般情况下,我们可以标签定义"OnMouseOver"及"OnMouseOut"两种事件的处理程序,
 所以鼠标移到文字上面,文字变成红色,鼠标移开后,又恢复原状。
 如果要让其它的元件,也具有相同的效果,可以在每一个标签中,建立相同的处理程序,但
 这绝对不是一个好办法。"Behavior"就是针对类似的问题,所得出的解决方案。我们可以
 将动态变化的处理程序,另存为一个以"htc"为扩展名的外部文件,如:
 1.htc
 <attch event="onmouseover" onevent="change1()"/>
 <attch event="onmouseover" onevent="change2()"/>
 
 <script language="vbscript">
 function change1()
 style.color="red"
 end function
 
 function change2()
 style.color="black"
 end function
 </script>
 
 主程序中,以套用CSS样式的语法,在<style>段落中,将"1.htc"设定为"Behavior"
 <html>
 <head>
 <title>xmllover</title>
 <style>
 p {behavior:url(1.htc)}
 </style>
 </head>
 
 <body>
 <center style="font-size:24;cursor:hand">
 <p>我是Xmllover我怕谁</p>
 <p>--万能五笔就是我--</p>
 </center>
 </body>
 </html>
 试试效果不行可以发现了吗???
 |