触发事件响应函数,如何把事件绑定给其他的函数,当触发事件时,能同时其他的响应函数?

解决方案 »

  1.   

    底层的事件源是OCX控件提供的.其他页面得不到这个事件.!
      

  2.   

     恩。或者2个函数并排,没有遇到RETURN 之类的语句,事件函数将会按顺序执行下去!参考代码:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     <html xmlns="http://www.w3.org/1999/xhtml">
     <head>
     <script type="text/javascript">
    window.onload=function(){
      document.getElementById('bt').onclick=function(){ //并排执行2个函数a和b;
         a(); 
         b(); 
     }
    }
    function a()
    {
     alert('a');
    }
    function b()
    {
    alert('b');
    }
    </script>
    </head>
    <body>
    <input type="button" value="提交" id="bt">
    </form>
    </body>
    </html>
    或者按1#的意思,函数内调用函数,参考例子:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     <html xmlns="http://www.w3.org/1999/xhtml">
     <head>
     <script type="text/javascript">
    window.onload=function(){
      document.getElementById('bt').onclick=function(){ 
         a(); 
     }
    }
    function a()
    {
     alert('a');
      b();//函数a调用b来执行
    }
    function b()
    {
    alert('b');
    }
    </script>
    </head>
    <body>
    <input type="button" value="提交" id="bt">
    </form>
    </body>
    </html>
      

  3.   

    1、 你说的到底是其他页面的另一个函数,如果是这个,那么就直接用JS来引用就好了!
      
    2、还是底层的事件源是OCX控件提供的.其他页面得不到这个事件??  这个指的是什么?