js模拟用户点击[z]

From: http://www.dlog.cn/html/diary/showlog.vm?sid=408&log_id=2504
function doClick(linkId){ 
                var obj = $(linkId);
                  if (document.createEvent)
                  {
                    var evObj = document.createEvent('MouseEvents');
                    evObj.initEvent( 'click', true, false );
                    obj.dispatchEvent(evObj);
                  }
                  else if (document.createEventObject)
                  {
                       obj.fireEvent('onclick');
                  }
}

你可能感兴趣的:(html)