这个是将事件绑定到HTML中的脚本代码上的。

解决方案 »

  1.   

    <HTML>
    <BODY ONLOAD="setupEventHandler()" LANGUAGE="VBS">
    <SCRIPT LANGUAGE="VBS">
    Dim i
    i=1
    function setupEventHandler()
        set fpchgBackground = getRef("chgBackground") '返回chgBackground这个函数的地址
        call mySpan.attachEvent("onclick", fpChgBackground) '绑定onClick事件
    end functionfunction chgBackground()
    if i=1 then
    document.bgColor = "blue"
    i=0
    else
        document.bgColor = "green"
    i=1
    end if
    end function</SCRIPT>
    <SPAN ID="mySpan">SPAN</SPAN>
    </BODY>
    </HTML>
      

  2.   

    to hydnoahark:
       谢谢,如果我想把一个ActiveX控件的事件绑定到一个函数上,不知道你能不能实现。如果能的话,请指教。分的多少无所谓。我有的是。