Recommendation: Cool right-click menu

Source: Internet
Author: User

Copy codeThe Code is as follows: <! -- ++ Between <body> </body> enter the following code:
Right-click to see!
<Style>
Body, td, a {font-size: 9pt; color: black}
. None {border: black 1px solid; background: D9D9D9; padding-top: 2}
. Over {border: black 1px solid; background: 707888; color: white; padding-top: 2}
</Style>
<Body oncontextmenu = "return false">
<Div style = "position: absolute; left: 100; top: 100; cursor: hand; display = 'none';" ID = plane
Onmousedown = "down = true; divleft = event. clientX-parseInt (plane. style. left );
Divtop = event. clientY-parseInt (plane. style. top) "onmouseup =" down = false ">
<Div align = center style = "position: absolute; left: 150px; top: 33px; width: 100px;
Height: 19px; z-index: 1; color: white; background: 707888; cursor: default; "class =" none"
Onmouseover = "menuin (); init ()"> right-click the menu </div>
<Div align = center id = "item1" style = "position: absolute; left: 50px; top: 55px; width: 99px;
Height: 19px; z-index: 2; filter: alpha (opacity = 0) "onmouseover =" this. className = 'over'; menuin ()"
Onmouseout = "this. className = 'none';" class = "none"
> <A href = http://www.pcedu.com.cn> network school </a> </div>
<Div align = center id = "item2" style = "position: absolute; left: 250px; top: 77px; width: 99px; height: 19px; z-index: 3; filter: alpha (opacity = 0 )"
Class = none onmouseover = "this. className = 'over'; menuin ()"
Onmouseout = "this. className = 'none';"> <a href = #> menu item 2 </a> </div>
<Div align = center id = "item3" style = "position: absolute; left: 50px; top: 99px; width: 99px; height: 19px; z-index: 4; filter: alpha (opacity = 0 )"
Class = none onmouseover = "this. className = 'over'; menuin ()"
Onmouseout = "this. className = 'none';"> menu item 3 </div>
<Div align = center id = "item4" style = "position: absolute; left: 250px; top: 121px; width: 99px; height: 19px; z-index: 5; filter: alpha (opacity = 0 )"
Class = none onmouseover = "this. className = 'over'; menuin ()"
Onmouseout = "this. className = 'none'; "> menu item 4 </div> <div align = center id =" item5 "style =" position: absolute; left: 50px; top: 143px; width: 99px; height: 19px; z-index: 6; filter: alpha (opacity = 0 )"
Class = none onmouseover = "this. className = 'over'; menuin ()"
Onmouseout = "this. className = 'none';"> menu item 5 </div>
</Div>
<Script language = "vbs">
Dim down, divleft, divtop, timelinestart, timelinestop, tidone, tidtwo, tidtree
Down = false
Timelinestart = 0
Timelinestop = 0
Sub document_onmousedown
If window. event. button = 2 then
Plane. style. display = ""
Plane. style. left = window. event. clientx-153
Plane. style. top = window. event. clienty-35
End if
End sub
Sub document_onmousemove
If down then
Plane. style. left = window. event. clientx-divleft
Plane. style. top = window. event. clienty-divtop
End if
End sub
Sub document_ondargstart
Window. event. returnvalue = false
End sub
Function menuin ()
Cleartimeout (tidtree)
End function
Sub document_onclick
Tidtree = settimeout ("outit ()", 200)
End sub
Function init ()
If timelinestart <> 5 then
Cleartimeout (tidtwo)
Item1.style. pixelLeft = item1.style. pixelLeft + 20
Item1.filters. alpha. opacity = item1.filters. alpha. opacity + 20
Item2.style. pixelLeft = item2.style. pixelLeft-20
Item2.filters. alpha. opacity = item2.filters. alpha. opacity + 20
Item3.style. pixelLeft = item3.style. pixelLeft + 20
Item3.filters. alpha. opacity = item3.filters. alpha. opacity + 20
Item4.style. pixelLeft = item4.style. pixelLeft-20
Item4.filters. alpha. opacity = item4.filters. alpha. opacity + 20
Item5.style. pixelLeft = item5.style. pixelLeft + 20
Item5.filters. alpha. opacity = item5.filters. alpha. opacity + 20
Timelinestart = timelinestart + 1
Else
Cleartimeout (tidone)
End if
Tidone = settimeout ("init ()", 1)
End function
Function outit ()
If timelinestart <> 0 then
Cleartimeout (tidone)
Item1.style. pixelLeft = item1.style. pixelLeft-20
Item1.filters. alpha. opacity = item1.filters. alpha. opacity-20
Item2.style. pixelLeft = item2.style. pixelLeft + 20
Item2.filters. alpha. opacity = item2.filters. alpha. opacity-20
Item3.style. pixelLeft = item3.style. pixelLeft-20
Item3.filters. alpha. opacity = item3.filters. alpha. opacity-20
Item4.style. pixelLeft = item4.style. pixelLeft + 20
Item4.filters. alpha. opacity = item4.filters. alpha. opacity-20
Item5.style. pixelLeft = item5.style. pixelLeft-20
Item5.filters. alpha. opacity = item5.filters. alpha. opacity-20
Timelinestart = timelinestart-1
Else
Cleartimeout (tidtwo)
Plane. style. display = "none"
Exit function
End if
Tidtwo = settimeout ("outit ()", 1)
End function
</Script>

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.