HTC的進階設(shè)計:Attach的應(yīng)用 <public:attach>所指定的處理程序,除了應(yīng)用在網(wǎng)頁中個別的無件外,也可以加上"FOR"屬生,來處理"Document"的事件。本例中,我設(shè)定的是"Document"的"Onclick"事件,所以在網(wǎng)頁的任何位置按左鍵,都可打開信息視窗。 xmllover.htc <public:component> <public:attach event="onlick" onevent="change1()" for="document" /> <script language="vbscript"> function change1() alert "我是xmllover,這是Document的事件" end function </script> </public:component>
xmllover.htm <html> <head> <title>xmllover</title> </head> <body style="Behavior:url(xmllover.htc)"> </body> </html> 如果將"for"的屬性改成"window"就是瀏覽視窗的處理程序 大家可以自己試試效果!
|