from:
http://dhtml-menu.com/examples/ex8-javascript-context-menu.html
http://dhtml-menu.com/examples/data-popup2.js.txt
代码
1
var
popupMode
=
1
;
2
3
var
blankImage
=
"
img/blank.gif
"
;
4
var
isHorizontal
=
0
;
5
var
menuWidth
=
0
;
6
var
absolutePos
=
0
;
7
var
posX
=
20
;
8
var
posY
=
10
;
9
var
floatable
=
0
;
10
var
floatIterations
=
5
;
11
var
movable
=
0
;
12
var
moveCursor
=
"
move
"
;
13
var
moveImage
=
"
img/movepic4.gif
"
;
14
var
moveWidth
=
12
;
15
var
moveHeight
=
18
;
16
var
fontStyle
=
"
normal 8pt Tahoma
"
;
17
var
fontColor
=
[
"
#3B3B3B
"
,
"
#FFFFFF
"
];
18
var
fontDecoration
=
[
"
none
"
,
"
none
"
];
19
var
itemBackColor
=
[
"
#FFFFEE
"
,
"
#4D74FD
"
];
20
var
itemBorderWidth
=
0
;
21
var
itemAlign
=
"
left
"
;
22
var
itemBorderColor
=
[
""
,
""
];
23
var
itemBorderStyle
=
[
"
solid
"
,
"
solid
"
];
24
var
itemBackImage
=
[
""
,
""
];
25
var
itemSpacing
=
0
;
26
var
itemPadding
=
2
;
27
var
itemCursor
=
"
default
"
;
28
var
itemTarget
=
""
;
29
var
iconTopWidth
=
16
;
30
var
iconTopHeight
=
16
;
31
var
iconWidth
=
16
;
32
var
iconHeight
=
16
;
33
var
menuBackImage
=
""
;
34
var
menuBackColor
=
""
;
35
var
menuBorderColor
=
"
#BFBFBF #737373 #4D4D4D #AAAAAA
"
;
36
var
menuBorderStyle
=
[
"
solid
"
];
37
var
menuBorderWidth
=
1
;
38
var
subMenuAlign
=
"
left
"
;
39
var
transparency
=
80
;
40
var
transition
=
10
;
41
var
transDuration
=
300
;
42
var
shadowColor
=
"
#C7C7C7
"
;
43
var
shadowLen
=
3
;
44
var
arrowImageMain
=
[
"
img/arrow_r.gif
"
,
"
img/arrow_r.gif
"
];
45
var
arrowImageSub
=
[
"
img/arrow_r.gif
"
,
"
img/arrow_r.gif
"
];
46
var
arrowWidth
=
7
;
47
var
arrowHeight
=
7
;
48
49
var
separatorImage
=
"
img/separ1.gif
"
;
50
var
separatorWidth
=
"
100%
"
;
51
var
separatorHeight
=
"
5
"
;
52
var
separatorAlignment
=
"
center
"
;
53
54
var
separatorVImage
=
"
img/separ1.gif
"
;
55
var
separatorVWidth
=
"
100&
"
;
56
var
separatorVHeight
=
"
5
"
;
57
var
statusString
=
"
text
"
;
58
var
pressedItem
=-
2
;
59
60
var
menuItems
=
[
61
[
"
Open Link
"
,
"
testlink.html
"
],
62
[
"
Open Link in New Window
"
,
"
testlink.html
"
,
""
,
""
,
""
,
"
_blank
"
],
63
[
"
More Info
"
,
"
testlink.html
"
],
64
[
"
|Help
"
,
"
testlink.html
"
],
65
[
"
|About
"
,
"
testlink.html
"
],
66
];
67
68
apy_init();
69
Popup Mode Example
Right click on document space to call a right-click context menu.
HTML:
<body bgcolor=#FFFFFF onContextMenu="return apy_popup(1, 1000, event);">
Mouseover the image to see a context dhtml menu:
HTML:
<img src="img/foto1.gif" width=90 height=98 hspace=10 onMouseOver="return apy_popup(0, 2000, event);" align=left>
Mouseover this link to see a second context dhtml menuHTML:
<a href="testlink.html" onMouseOver="return apy_popup(1, 1000, event);">
Click this link to see a second context dhtml menuHTML:
<a href="#" onClick="return apy_popup(1, 1000, event);">
To create a popup menu you should set following parameters:
var popupMode=1;
To show a popup menu assign the following function call to event:
yourEvent = "return apy_popup(menuN, pause, event);"
Where:
yourEvent - event type (onMouseOver, onClick, onContextMenu, etc.)
menuN - menu number on page.
pause - inactivity delay.
event - reserved. Do not change.
For example:
<img src="pic" onMouseOver="return apy_popup(0, 2000, event);">
To see configuration file (.js file) click here:
popup-menu 1 popup-menu 2.