ie 6-8支持event事件,ff浏览器不支持

 

获取鼠标点击位置的坐标
document.onclick = function(){
    alert(event.clientX +"-"+ event.clientY)
}

ff浏览器支持传参自带的event事件

获取鼠标点击位置的坐标
document.onclick = function(ev){
    alert(ev.clientX +"-"+ ev.clientY)
}

因此可以做一个兼容ie和ff的事件

获取鼠标点击位置的坐标
document.onclick = function(ev){
    var oEvent = ev || event;
    alert(oEvent .clientX +"-"+ oEvent .clientY)
}

 

相关文章:

  • 2022-12-23
  • 2021-06-19
  • 2022-02-07
  • 2021-10-09
  • 2021-06-12
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-03-06
  • 2021-09-15
  • 2022-02-24
相关资源
相似解决方案