In fact, do not Bootstrap also do, purely for good-looking ...
The first thing to do is to screen out the browser's default right-click menu where you need to pop the right button:
Then write ShowMenu this function:
function ShowMenu () {
document.getElementById ("tree"). onmousedown = function (e) {
if (E.which = = 3) {
It is very easy to use javascript to determine whether the user clicks the Left or Right button. You only need to add the onmousedown event to the object and use the javascript e. button value to determine whether the user clicks the event. The following is an example.
Document. onmousedown = judgeMouseButton; function judgeMouseButton (e) {var e = window. event
Some websites will block your right-click or use shortcut keys for copying.
CodeThe solution is to directly Save the webpage and delete the following JavaScript code. Then, you can use the right-click menu.
Of course, you can also solve the problem by setting the security
First, some concepts: 1. The mouse event has a Botton property: Returns an integer that indicates which mouse button was clicked.BUG: In IE and standard DOM mouse events, the only button property value is the same as the "Right-click" event, which returns 2. 2, the event onmousedown: the mouse button press action.Event OnContextMenu: Another event triggered by clicking the mouse. 3, interrupt the default ev
A Javascript script that disables right-click, select, drag, clear clipboard, and save a webpage as a prohibited object.
It is quite common. If you do not want to write it, copy it and use it directly without other settings.
Two days ago found a good site on the Internet, is used to do data collection (http://wolf.360doc.com ).
This website provides such a function to directly add the selected text to your favorites. At that time, it was amazing. Later I studied and found that using JavaScript and registry scripts can achieve this function.
The code for right-click to add a page to f
Look at the code:
The code is as follows
Copy Code
Right on top of me, look.
Right-click on the top of the text, pop-up message box, as shown:
The same function, can be implemented in many ways, it depends on your personal practice, the above functions can also be achieved through the following code:
The code i
Javascript: Use a Popup object to build a webpage right-click menu, Javascript tutorial
The Code is as follows:
Right-click the Popup object implementation menu
1. the right mouse button will be completely shielded
Oncontextmenu = "window. event. returnvalue = false"
2. Cancel selection and prevent Replication
3. Do not pasteOnpaste = "Return false"
4. Prevent Replication
5. Replace the IE icon in front of the address bar
6. You can display your icons in the favorites folder.
8. The script will never go wrong.
9. Disable the Input Method
10. Always carry the fram
The right-click menu and drag-and-drop functions based on JavaScript are described as follows:
Problems solved in this Chapter
1. Implement the right-click menu function code.
2. Stop the actual application of default events.
Right
Due to project requirements, some text boxes need to disable the right-click and copy-and-paste functions, which were just implemented in JS yesterday.
The Code is as follows:
Function click (e){If (document. all){If (event. button = 1 | event. button = 2 | event. button = 3){Oncontextmenu = 'Return false ';}}If (do
Some websites will always block your right-click or copy with shortcut keys. In fact, it is just a piece of js Code. The solution is to save the webpage directly and then delete the following JavaScript code, then you can right-click the menu.Of course, you can also solve th
Javascript implements custom right-click behavior, and Js implements custom Behavior
Custom right-click behavior (get the coordinates of the mouse (x, y) through the event object ))
The above is all the content shared in this article. I hope you will like it.
Please take a
Two days ago found a good site on the Internet, is used to do the data collection (http://wolf.360doc.com).
This site provides such a function, you can directly put your selected text collection, at that time feel very magical. Later, it was discovered that using JavaScript and registry scripts would enable such a function.
Right-click to bookmark the page code b
This article illustrates the JavaScript custom right-click pop-up menu implementation method. Share to everyone for your reference. The implementation method is as follows:
The wants this article to help you with your JavaScript programming.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.