Home > front end >  Javascript method in the simulation of the mouse to click, click (), and how to simulate the right m
Javascript method in the simulation of the mouse to click, click (), and how to simulate the right m

Time:10-26

Want to write a simple js script, the function is to canine teeth barrage, for example, b station barrage to realize the function of a report,

CodePudding user response:

Would you please the mouse scroll down , you can see the right mouse button click event

CodePudding user response:

Judging by onm ousedown or onm ouseup event event object
For example,
Document. The getElementById (" test "). onm ousedown=function (e) {
If (e.b utton==2) {
Alert (" you some right ");
} else if (e.b utton==0) {
Alert (" you ordered left ");
} else if (e.b utton==1) {
Alert (" you ordered roller ");
}
}

CodePudding user response:

refer to the second floor qybao response:
judging by onm ousedown or onm ouseup event object
For example,
Document. The getElementById (" test "). onm ousedown=function (e) {
If (e.b utton==2) {
Alert (" you some right ");
} else if (e.b utton==0) {
Alert (" you ordered left ");
} else if (e.b utton==1) {
Alert (" you ordered roller ");
}
}



This sure is not tease me?

CodePudding user response:

Didn't notice, thought it was to determine whether the mouse right click on the
You can use the
XXX. The trigger (mousedown, [' right ']); Right click the mouse to simulate call XXX

CodePudding user response:

reference 4 floor qybao response:
didn't note that thought is to determine whether the mouse right click on the
You can use the
XXX. The trigger (mousedown, [' right ']); Right click the mouse to simulate call XXX

Google and firefox is not a function

CodePudding user response:

reference 5 floor don't quit your giggle 2018 response:
Quote: refer to 4th floor qybao response:
didn't note that thought is to determine whether the mouse right click on the
You can use the
XXX. The trigger (mousedown, [' right ']); Right click the mouse to simulate call XXX

Google and firefox is not a function
you refer to documents and examples of the jquery try
https://api.jquery.com/trigger/

CodePudding user response:

reference 5 floor don't quit your giggle 2018 response:
Quote: refer to 4th floor qybao response:
didn't note that thought is to determine whether the mouse right click on the
You can use the
XXX. The trigger (mousedown, [' right ']); Right click the mouse to simulate call XXX

Google and firefox is not a function
use createevent, which can also
dispatcheventRefer to the following documents and example
https://www.w3schools.com/jsref/event_createevent.asp
  • Related