自定義的METHOD: 在"HTC"中建立的副程序,除了讓HTC本身的處理程序使用,還可以加入<Public:method name="程序名稱"> 聲明成自定義的"METHOD",讓主程序的元件使用。見如下代碼: xmllover.htc <public:method name="change1()"/> <Script language="vbscript"> pos=1 sub change1() str="我是xmllover我怕誰~~~" text1=space(20)+str element.value=mid(text1,pos) pos=pos+1 if pos>len(text1) then pos=1 end sub </script>
xmllover.htm <html> <head> <title>xmllover</title> <style> .type1 {behavior:url(xmllover.htc)} </style> <script language="vbscript"> sub start() window.setinterval "t1.change1",500 end sub </script> </head>
</body> <input type="text" name="t1" size="24" class="type1" style="font-size:18"> <p> <input type="button" name="b1" value="click me" onclick="start()"> </body> </html> 自定義的動畫效果!!!
|