简体   繁体   English

OnSelectStart在Firefox上不起作用

[英]OnSelectStart doesn't work on Firefox

I have this code: 我有以下代码:

<div id="menu_blue" onSelectStart="show_and_hide()">
  ...
</div>
<div id="menu_red">
  ...
</div>

<script>
function show_and_hide()
{
    $("#menu_red").slideToggle("slow");
}
</script>

and my firefox version 38.0.5 doesn't want to do anything. 而我的Firefox版本38.0.5不想做任何事情。 I know it could be replaced by OnClick="" but I want to know why firefox does't support this function. 我知道可以用OnClick=""代替,但是我想知道为什么firefox不支持此功能。 Does anybody know? 有人知道吗 Thank you. 谢谢。

Rather than using doing your click event handlers in HTML it is better to bind them on the document ready or load. 与其在HTML中使用click事件处理程序,不如将它们绑定到准备就绪或加载的文档上。

$(document).on("ready",function(){
 $("#menuBttn").on("click",function(event){

  })
})

Also you might find this useful, http://help.dottoro.com/ljwdpnva.php 另外,您可能会发现这很有用, http://help.dottoro.com/ljwdpnva.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM