举个例子,dispatchEvent如何使用,在网上我都没有搜索到

解决方案 »

  1.   

    找到了,谢谢楼上的提醒,用下面代码就行的<button id="bb" onclick="alert(this.id)">abc</button><button onclick="bb.onclick()">def</button><button onclick="document.getElementById('bb').dispatchEvent(event)">ghi</button>
      

  2.   

    您好!请问在netscape下click某一按钮如何触发另一文本框的onkeydown事件如果直接用dispatchEvent(event)则是自己由什么事件触发也就只能触发另一文本框的什么事件<input id="bb" onclick="alert('onclick')" onkeydown="alert('onkeydown')"><button onclick="bb.onkeydown()">def</button><button onclick="document.getElementById('bb').dispatchEvent(event)">ghi</button>在netscape中怎么单击ghi,触发bb的onkeydown事件谢谢!