Jump to content
Fórum Script Brasil
  • 0

CLICK DO MOUSE


id4689

Question

4 answers to this question

Recommended Posts

  • 0

funfou não cara

<script type="text/javascript">
function whichButton(event)
{
if (event.button==2)
  {
  alert("You clicked the right mouse button!")
  }
else
  {
  alert("You clicked the left mouse button!")
  }
}

setInterval(document.body.onclick = function(){
alert("fui clicado");
},300);

</script>

tá certo ?

sem element sem objeto não funciona...

Edited by id4689
Link to comment
Share on other sites

  • 0

consegui fasendo desta forma

<html>
  <head>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
  </head>
  <body>
    <script type="text/javascript">
      $('body').click(function() {
          $('body').trigger('click'); 
        // do something here like:
        alert('hey! The body click is working!!!')
      });
    </script>
  </body>
</html>

no entanto só funciona no iexplorer 9 aqui testado, outros navegadores ff e chrome não funciona.. e agora oque eu faço ?

Link to comment
Share on other sites

  • 0

resolvido:

<script type="text/javascript" 
   src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>


    <script type="text/javascript">
    
     $('body').click(function(){
        alert('hey! The body click is working!!!')
      });
      
      $('body').trigger('click'); 
    </script>

Edited by id4689
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...