Не сте регистриран! Регистрирайте се БЕЗПЛАТНО, за да използвате услугите на сайта!

 Contex меню
Автор  eminem (01.04.2005 22:36) съобщение до автора
Погледнат  846 пъти добави към любими
Оценка добави коментар
Гласове  1 изпрати на приятел
Коментари  (0) абонирай се за JavaScript
     
eminem
     
 

Контексто меню, което може да си сложите на вашата страница.

CODE
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<html>
<
head>
<
style>
<!--
.
skin0{
position:absolute;
width:200px;
border:2px solid black;
background-color:menu;
font-family:Verdana;
line-height:20px;
cursor:default;
visibility:hidden;
}

.
skin1{
cursor: default;
font: menutext;
position: absolute;
width: 165px;
background-color: menu;
border: 1 solid buttonface;
visibility:hidden;
border: 2 outset buttonhighlight;
}

.
menuitems{
padding-left:15px;
padding-right:10px;
}
-->
</
style>

<
script language="JavaScript1.2">
//
set the skin of the menu (0 or 1, with 1 rendering a default Windows menu like skin)
var menuskin=1

//
set this variable to 1 if you wish the URLs of the highlighted menu to be displayed in the status bar
var display_url
=0


function showmenuie5(){
//
Find out how close the mouse is to the corner of the window
var rightedge
=document.body.clientWidth-event.clientX
var bottomedge
=document.body.clientHeight-event.clientY

//
if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<ie5menu.offsetWidth)
//
move the horizontal position of the menu to the left by it's width
ie5menu
.style.left=document.body.scrollLeft+event.clientX-ie5menu.offsetWidth
else
//
position the horizontal position of the menu where the mouse was clicked
ie5menu
.style.left=document.body.scrollLeft+event.clientX

//
same concept with the vertical position
if
(bottomedge<ie5menu.offsetHeight)
ie5menu.style.top=document.body.scrollTop+event.clientY-ie5menu.offsetHeight
else
ie5menu.style.top=document.body.scrollTop+event.clientY

ie5menu
.style.visibility="visible"
return false
}

function hidemenuie5(){
ie5menu.style.visibility="hidden"
}

function highlightie5(){
if (event.srcElement.className=="menuitems"){
event.srcElement.style.backgroundColor="highlight"
event.srcElement.style.color="white"
if (display_url==1)
window.status=event.srcElement.url
}
}

function lowlightie5(){
if (event.srcElement.className=="menuitems"){
event.srcElement.style.backgroundColor=""
event.srcElement.style.color="black"
window.status=''
}
}

function jumptoie5(){
if (event.srcElement.className=="menuitems"){
if (event.srcElement.getAttribute("target")!=null)
window.open(event.srcElement.url,event.srcElement.getAttribute("target"))
else
window.location=event.srcElement.url
}
}

</
script>
</
head>
<
body>
<!--
[if IE]>
<
div id="ie5menu" class="skin0" onMouseover="highlightie5()" onMouseout="lowlightie5()" onClick="jumptoie5()">
<
div class="menuitems" url="http://1.hit.bg">IT Scripts</div>
<
div class="menuitems" url="http://1.hit.bg" target="newwin">What's New?</div>
<
div class="menuitems" url="http://1.hit.bg">What's Hot?</div>
<
div class="menuitems" url="http://1.hit.bg">Message Forum</div>
<
div class="menuitems" url="http://1.hit.bg">FAQs</div>
<
div class="menuitems" url="http://1.hit.bg">Submit</div>
<
hr>
<
div class="menuitems" url="mailto:твоят e-mail@yahoo.com">Email Us</div>
</
div>
<!
[endif]-->
<
script language="JavaScript1.2">
if (document.all&&window.print){
if (menuskin==0)
ie5menu.className="skin0"
else
ie5menu.className="skin1"
document.oncontextmenu=showmenuie5
document.body.onclick=hidemenuie5
}
</
script>
</
body>
</
html>



Ключови думи: javascript меню context menu контекст




 1 посетител чете този скрипт (0 потребители и 1 гост)  
Активни потребители: ---
   
  

Еmail  
 

 

 
  • Интересно от Софтуер
 
  • Интересно от myLINKS
 
 
 
 



IT-PLACE.NET © 2004 - 2008