<% @ Page language = "java" pageEncoding = "GBK" %> <! Doctype html public "-// w3c // dtd html 4.0 transitional // en">
Run code
Copy code
Save code
Add to favorites
Code explanation:
1. When loading a page, execute the load1 () method first.
First, check whether it is Internet Explorer. If the current browser is Internet Explorer, document. all returns true. The following definition should be valid. That is to say, when the browser used by the client is IE, the showmenuie5 function is called when the user generates a right-click event. When the user generates a left-click event, the hidemenuie5 function is called.
2. Next we should consider how to display and hide menus through the showmenuie5 function and hidemenuie5 function.
Of course, the menu here is not really a right-click menu, but a div we made ourselves. In this div, We will install what we want to install. You can use the mouse event to call a function to control its explicit and hidden state, which achieves the same effect of using the right mouse button.
The outermost layer of this block is a div with an id of ie5menu. We have defined its style as skin0. You can also customize other styles and then replace skin0.
3. Click the menu option.
The jumptoie5 () function enables you to right-click a layer in the menu, that is, the execution option.