11
28
2008
1

[JavaScript]程序触发点击事件

function doClick(obj){
    if (document.createEvent){//火狐写法
        var evObj = document.createEvent('MouseEvents');
        evObj.initEvent( 'click', true, false );
        obj.dispatchEvent(evObj);
    }else{//ie写法
        obj.click();
    }
}

ie比较简单,但不规范,火狐代码多一点,但是规规矩矩

但是似乎`

Category: JavaScript | Tags: javascript 鼠标点击

Host by is-Programmer.com | Power by Chito 1.3.3 beta | Theme: Aeros 2.0 by TheBuckmaker.com