RT。
我想让用户在离开一个div即onmouseout事件中产生一个回发事件,如何做到?

解决方案 »

  1.   

    <div onmouseout="document.forms[0].submit();"></div>
      

  2.   

    首先要确定回发给谁?!假设触发一个按钮,那么可以写:
      thePanel.Attributes["onmouseout"]=
        this.Page.ClientScript.GetPostBackEventReference(theButton,"");假设是在一个控件里,特别是在ascx或者aspx中定义被触发的后台代码,那么可以让你的用户控件或者页面的类型使用IPostbackEventHandler接口(它其实仅仅定义了一个方法),然后写代码让客户端触发它:
      thePanel.Attributes["onmouseout"]=
        this.Page.ClientScript.GetPostBackEventReference(this,"");IPostbackEventHandler是将一个服务器程序与脚本回发关键,GetPostBackEventReference、GetPostBackClientHyperlink是你用来产生脚本代码的函数。你可以使用msn或者Google察看一下IPostbackEventHandler、GetPostBackEventReference、GetPostBackClientHyperlink的使用方法。