Spiga
Posts - 291, Articles - 22, Comments - 115
Cnblogs
Dashboard
Login
Home
Contact
Gallery
RSS
酷鸭战线
世界很大,每个人总有相同的地方!你喜欢的电影我也喜欢,我喜欢的作品你也喜欢! 就是这样,其实生活并不孤单。
经典右键菜单制作
2004-11-19 16:47 by QDuck, 712 visits,
收藏
,
编辑
<
HTML
>
<
HEAD
>
<
TITLE
>
右键菜单
</
TITLE
>
<
style
type
="text/css"
>
<!--
body
{
}
{
font-size
:
9pt
;
}
table
{
}
{
font-size
:
9pt
;
cursor
:
default
;
margin
:
0
;
}
tr
{
}
{
height
:
20
;
}
tr.over
{
}
{
font-size
:
9pt
;
color
:
#ffffff
;
background-color
:
#66aadd
;
cursor
:
default
;
}
tr.out
{
}
{
font-size
:
9pt
;
color
:
#ffffff
;
background-color
:
#336699
;
cursor
:
default
;
}
div.rm_div
{
}
{
position
:
absolute
;
filter
:
Alpha(Opacity='95')
;
display
:
none
;
border
:
2px outset #3377aa
;
background-color
:
#336699
;
width
:
0
;
height
:
0
;
}
hr.sperator
{
}
{
border
:
1px inset #3377aa
;
}
-->
</
style
>
<
script
language
="JScript"
>
<!--
function
RightMenu()
{
this
.AddExtendMenu
=
AddExtendMenu;
this
.AddItem
=
AddItem;
this
.GetMenu
=
GetMenu;
this
.HideAll
=
HideAll;
this
.I_OnMouseOver
=
I_OnMouseOver;
this
.I_OnMouseOut
=
I_OnMouseOut;
this
.I_OnMouseUp
=
I_OnMouseUp;
this
.P_OnMouseOver
=
P_OnMouseOver;
this
.P_OnMouseOut
=
P_OnMouseOut;
A_rbpm
=
new
Array();
HTMLstr
=
""
;
HTMLstr
+=
"
<!-- RightButton PopMenu -->\n
"
;
HTMLstr
+=
"
\n
"
;
HTMLstr
+=
"
<!-- PopMenu Starts -->\n
"
;
HTMLstr
+=
"
<div id='E_rbpm' class='rm_div'>\n
"
;
//
rbpm = right button pop menu
HTMLstr
+=
"
<table width='100%' border='0' cellspacing='0'>\n
"
;
HTMLstr
+=
"
<!-- Insert A Extend Menu or Item On Here For E_rbpm -->\n
"
;
HTMLstr
+=
"
</table>\n
"
;
HTMLstr
+=
"
</div>\n
"
;
HTMLstr
+=
"
<!-- Insert A Extend_Menu Area on Here For E_rbpm -->
"
;
HTMLstr
+=
"
\n
"
;
HTMLstr
+=
"
<!-- PopMenu Ends -->\n
"
;
}
function
AddExtendMenu(id,name,parent)
{
var
TempStr
=
""
;
if
(HTMLstr.indexOf(
"
<!-- Extend Menu Area : E_
"
+
id
+
"
-->
"
)
!=
-
1
)
{
alert(
"
E_
"
+
id
+
"
already exist!
"
);
return
;
}
eval(
"
A_
"
+
parent
+
"
.length++
"
);
eval(
"
A_
"
+
parent
+
"
[A_
"
+
parent
+
"
.length-1] = id
"
);
//
将此项注册到父菜单项的ID数组中去
TempStr
+=
"
<!-- Extend Menu Area : E_
"
+
id
+
"
-->\n
"
;
TempStr
+=
"
<div id='E_
"
+
id
+
"
' class='rm_div'>\n
"
;
TempStr
+=
"
<table width='100%' border='0' cellspacing='0'>\n
"
;
TempStr
+=
"
<!-- Insert A Extend Menu or Item On Here For E_
"
+
id
+
"
-->
"
;
TempStr
+=
"
</table>\n
"
;
TempStr
+=
"
</div>\n
"
;
TempStr
+=
"
<!-- Insert A Extend_Menu Area on Here For E_
"
+
id
+
"
-->
"
;
TempStr
+=
"
<!-- Insert A Extend_Menu Area on Here For E_
"
+
parent
+
"
-->
"
;
HTMLstr
=
HTMLstr.replace(
"
<!-- Insert A Extend_Menu Area on Here For E_
"
+
parent
+
"
-->
"
,TempStr);
eval(
"
A_
"
+
id
+
"
= new Array()
"
);
TempStr
=
""
;
TempStr
+=
"
<!-- Extend Item : P_
"
+
id
+
"
-->\n
"
;
TempStr
+=
"
<tr id='P_
"
+
id
+
"
' class='out'
"
;
TempStr
+=
"
onmouseover='P_OnMouseOver(\
""
+id+
"
\
"
,\
""
+parent+
"
\
"
)'
"
;
TempStr
+=
"
onmouseout='P_OnMouseOut(\
""
+id+
"
\
"
,\
""
+parent+
"
\
"
)'
"
;
TempStr
+=
"
onmouseup=window.event.cancelBubble=true;
"
;
TempStr
+=
"
onclick=window.event.cancelBubble=true;
"
;
TempStr
+=
"
><td nowrap>
"
;
TempStr
+=
"
"
+
name
+
"
</td><td style='font-family: webdings; text-align: right;'>4
"
;
TempStr
+=
"
</td></tr>\n
"
;
TempStr
+=
"
<!-- Insert A Extend Menu or Item On Here For E_
"
+
parent
+
"
-->
"
;
HTMLstr
=
HTMLstr.replace(
"
<!-- Insert A Extend Menu or Item On Here For E_
"
+
parent
+
"
-->
"
,TempStr);
}
function
AddItem(id,name,parent,location)
{
var
TempStr
=
""
;
var
ItemStr
=
"
<!-- ITEM : I_
"
+
id
+
"
-->
"
;
if
(id
==
"
sperator
"
)
{
TempStr
+=
ItemStr
+
"
\n
"
;
TempStr
+=
"
<tr style='height: 3;' class='out' onclick='window.event.cancelBubble=true;' onmouseup='window.event.cancelBubble=true;'><td colspan='2'><hr class='sperator'></td></tr>
"
;
TempStr
+=
"
<!-- Insert A Extend Menu or Item On Here For E_
"
+
parent
+
"
-->
"
;
HTMLstr
=
HTMLstr.replace(
"
<!-- Insert A Extend Menu or Item On Here For E_
"
+
parent
+
"
-->
"
,TempStr);
return
;
}
if
(HTMLstr.indexOf(ItemStr)
!=
-
1
)
{
alert(
"
I_
"
+
id
+
"
already exist!
"
);
return
;
}
TempStr
+=
ItemStr
+
"
\n
"
;
TempStr
+=
"
<tr id='I_
"
+
id
+
"
' class='out'
"
;
TempStr
+=
"
onmouseover='I_OnMouseOver(\
""
+id+
"
\
"
,\
""
+parent+
"
\
"
)'
"
;
TempStr
+=
"
onmouseout='I_OnMouseOut(\
""
+id+
"
\
"
)'
"
;
TempStr
+=
"
onclick='window.event.cancelBubble=true;'
"
;
if
(location
==
null
)
TempStr
+=
"
onmouseup='I_OnMouseUp(\
""
+id+
"
\
"
,\
""
+parent+
"
\
"
,null)'
"
;
else
TempStr
+=
"
onmouseup='I_OnMouseUp(\
""
+id+
"
\
"
,\
""
+parent+
"
\
"
,\
""
+location+
"
\
"
)'
"
;
TempStr
+=
"
><td nowrap>
"
;
TempStr
+=
"
"
+
name
+
"
"
;
TempStr
+=
"
</td><td></td></tr>\n
"
;
TempStr
+=
"
<!-- Insert A Extend Menu or Item On Here For E_
"
+
parent
+
"
-->
"
;
HTMLstr
=
HTMLstr.replace(
"
<!-- Insert A Extend Menu or Item On Here For E_
"
+
parent
+
"
-->
"
,TempStr);
}
function
GetMenu()
{
return
HTMLstr;
}
function
I_OnMouseOver(id,parent)
{
var
Item;
if
(parent
!=
"
rbpm
"
)
{
var
ParentItem;
ParentItem
=
eval(
"
P_
"
+
parent);
ParentItem.className
=
"
over
"
;
}
Item
=
eval(
"
I_
"
+
id);
Item.className
=
"
over
"
;
HideAll(parent,
1
);
}
function
I_OnMouseOut(id)
{
var
Item;
Item
=
eval(
"
I_
"
+
id);
Item.className
=
"
out
"
;
}
function
I_OnMouseUp(id,parent,location)
{
var
ParentMenu;
window.event.cancelBubble
=
true
;
OnClick();
ParentMenu
=
eval(
"
E_
"
+
parent);
ParentMenu.display
=
"
none
"
;
if
(location
==
null
)
eval(
"
Do_
"
+
id
+
"
()
"
);
else
window.open(location);
}
function
P_OnMouseOver(id,parent)
{
var
Item;
var
Extend;
var
Parent;
if
(parent
!=
"
rbpm
"
)
{
var
ParentItem;
ParentItem
=
eval(
"
P_
"
+
parent);
ParentItem.className
=
"
over
"
;
}
HideAll(parent,
1
);
Item
=
eval(
"
P_
"
+
id);
Extend
=
eval(
"
E_
"
+
id);
Parent
=
eval(
"
E_
"
+
parent);
Item.className
=
"
over
"
;
Extend.style.display
=
"
block
"
;
Extend.style.posLeft
=
document.body.scrollLeft
+
Parent.offsetLeft
+
Parent.offsetWidth
-
4
;
if
(Extend.style.posLeft
+
Extend.offsetWidth
>
document.body.scrollLeft
+
document.body.clientWidth)
Extend.style.posLeft
=
Extend.style.posLeft
-
Parent.offsetWidth
-
Extend.offsetWidth
+
8
;
if
(Extend.style.posLeft
<
0
) Extend.style.posLeft
=
document.body.scrollLeft
+
Parent.offsetLeft
+
Parent.offsetWidth;
Extend.style.posTop
=
Parent.offsetTop
+
Item.offsetTop;
if
(Extend.style.posTop
+
Extend.offsetHeight
>
document.body.scrollTop
+
document.body.clientHeight)
Extend.style.posTop
=
document.body.scrollTop
+
document.body.clientHeight
-
Extend.offsetHeight;
if
(Extend.style.posTop
<
0
) Extend.style.posTop
=
0
;
}
function
P_OnMouseOut(id,parent)
{
}
function
HideAll(id,flag)
{
var
Area;
var
Temp;
var
i;
if
(
!
flag)
{
Temp
=
eval(
"
E_
"
+
id);
Temp.style.display
=
"
none
"
;
}
Area
=
eval(
"
A_
"
+
id);
if
(Area.length)
{
for
(i
=
0
; i
<
Area.length; i
++
)
{
HideAll(Area[i],
0
);
Temp
=
eval(
"
E_
"
+
Area[i]);
Temp.style.display
=
"
none
"
;
Temp
=
eval(
"
P_
"
+
Area[i]);
Temp.className
=
"
out
"
;
}
}
}
document.onmouseup
=
OnMouseUp;
document.onclick
=
OnClick;
function
OnMouseUp()
{
if
(window.event.button
==
2
)
{
var
PopMenu;
PopMenu
=
eval(
"
E_rbpm
"
);
HideAll(
"
rbpm
"
,
0
);
PopMenu.style.display
=
"
block
"
;
PopMenu.style.posLeft
=
document.body.scrollLeft
+
window.event.clientX;
PopMenu.style.posTop
=
document.body.scrollTop
+
window.event.clientY;
if
(PopMenu.style.posLeft
+
PopMenu.offsetWidth
>
document.body.scrollLeft
+
document.body.clientWidth)
PopMenu.style.posLeft
=
document.body.scrollLeft
+
document.body.clientWidth
-
PopMenu.offsetWidth;
if
(PopMenu.style.posLeft
<
0
) PopMenu.style.posLeft
=
0
;
if
(PopMenu.style.posTop
+
PopMenu.offsetHeight
>
document.body.scrollTop
+
document.body.clientHeight)
PopMenu.style.posTop
=
document.body.scrollTop
+
document.body.clientHeight
-
PopMenu.offsetHeight;
if
(PopMenu.style.posTop
<
0
) PopMenu.style.posTop
=
0
;
}
}
function
OnClick()
{
HideAll(
"
rbpm
"
,
0
);
}
//
Add Your Function on following
function
Do_viewcode()
{window.location
=
"
view-source:
"
+
window.location.href;}
function
Do_help()
{window.showHelp(window.location);}
function
Do_exit()
{window.close();}
function
Do_refresh()
{window.location.reload();}
function
Do_back()
{history.back();}
function
Do_forward()
{history.forward();}
function
Do_author()
{alert(
"
姓名:杨俊\n网名:风舞影天(Snwcwt)\nE_mail:snwcwt.com@263.net\n个人主页:http://202.115.147.160/snwcwt(正在制作中)\n
"
)}
-->
</
script
>
</
HEAD
>
<
BODY
oncontextmenu
=window.event.returnValue=false>
<div id
='snwcwt'> </div>
<script language
="JScript"
>
<!--
var menu = new RightMenu();
menu.AddExtendMenu("location","我的链接","rbpm");
menu.AddExtendMenu("lscit","四川工业学院校园网","location");
menu.AddItem("scit_scit","川工首页","lscit","http://www.scit.edu.cn");
menu.AddItem("scit_lib","川工图书馆","lscit","http://202.115.151.46");
menu.AddItem("sperator","","lscit",null);
menu.AddItem("scit_century","世纪学苑","lscit","http://202.115.148.230/");
menu.AddItem("scit_the5","第五空间","lscit","http://the5.scit.edu.cn/");
menu.AddItem("scit_lianyi","联谊网站","lscit","http://202.115.148.240");
menu.AddItem("scit_message","信息导报","lscit","http://202.115.151.114/xx");
menu.AddItem("scit_student","书生之家川工境象","lscit","http://202.115.151.100");
menu.AddItem("sperator","","lscit",null);
menu.AddItem("scit_bbs","川工BBS","lscit","http://202.115.144.32");
menu.AddItem("scit_cbbs","世纪学苑BBS","lscit","http://202.115.144.37");
menu.AddExtendMenu("stunet","学生网站","location");
menu.AddItem("stu_century","世纪学苑","stunet","http://202.115.148.230/");
menu.AddItem("stu_wjl","望江楼","stunet","http://wjl.scu.edu.cn");
menu.AddItem("stu_freedim","自由天地","stunet","http://www.freedim.net/");
menu.AddItem("stu_stuhome","学生之家","stunet","http://www.stuhome.net");
menu.AddItem("stu_rw","人文网","stunet","http://www.rw.uestc.edu.cn/");
menu.AddItem("stu_the5","第五空间","stunet","http://the5.scit.edu.cn/");
menu.AddItem("stu_flying","我心飞扬","stunet","http://flying.swpi.edu.cn/");
menu.AddItem("stu_21cn","21CN校园网","stunet","http://www.21cn.edu.cn/");
menu.AddItem("stu_yaguo","网虫乐园","stunet","http://www.yaguo.com/");
menu.AddItem("sperator","","location",null);
menu.AddExtendMenu("computer","电脑类网站","location");
menu.AddExtendMenu("C_all","综合性网站","computer");
menu.AddItem("ca_yesky","天极网","C_all","http://www.yesky.com");
menu.AddExtendMenu("C_program","程序员网站","computer");
menu.AddItem("cp_program","中国程序员网站","C_program","http://www.chinaprogrammer.com/");
menu.AddItem("sperator","","C_program",null);
menu.AddItem("cp_51js","无忧脚本","C_program","http://www.51js.com/");
menu.AddItem("sperator","","C_program",null);
menu.AddItem("cp_active","中国动感技术网络","C_program","http://www.chinaasp.com/active/");
menu.AddItem("cp_aspcn","ASP中华网","C_program","http://www.aspcn.com/");
menu.AddItem("cp_aspx","中国ASP联盟","C_program","http://www.chinaspx.com/");
menu.AddExtendMenu("C_magzine","杂志网站","computer");
menu.AddItem("cm_cpcw","电脑报","C_magzine","http://www.cpcw.com");
menu.AddItem("cm_cfan","电脑爱好者","C_magzine","http://www.cfan.net.cn");
menu.AddItem("cm_popsoft","大众软件","C_magzine","http://www.popsoft.com");
menu.AddExtendMenu("C_luntan","技术性论坛","computer");
menu.AddItem("cl_chinaasp","ChinaASP论坛","C_luntan","http://www.chinaasp.com/sqlbbs");
menu.AddExtendMenu("C_book","书籍下载","computer");
menu.AddItem("cb_huachu","华储网上书店","C_book","http://www.huachu.com.cn/");
menu.AddExtendMenu("hacker","黑客天地","location");
menu.AddItem("hk_honker","<font style='color: #ff0000;'>中国红客联盟</font>","hacker","http://www.cnhonker.com");
menu.AddItem("sperator","","location",null);
menu.AddExtendMenu("lmovie","影视天地","location");
menu.AddItem("mov_wcums","华西网上影院","lmovie","http://202.115.100.8/");
menu.AddExtendMenu("lmusic","音乐空间","location");
menu.AddItem("mus_tyfo","天虎音乐网","lmusic","http://music.tyfo.com/");
menu.AddItem("mus_langqin","浪琴音乐","lmusic","http://www.langqin.net/");
menu.AddItem("mus_wcums","华西音乐空间","lmusic","http://music.wcums.edu.cn/");
menu.AddExtendMenu("lmud","泥巴链接","location");
menu.AddItem("lmud_mudking","泥巴大王","lmud","http://www.mudking.com");
menu.AddItem("lmud_justmud","泥巴城堡","lmud","http://www.justmud.com");
menu.AddItem("lmud_mudall","世界泥巴资源","lmud","http://www.mudall.com");
menu.AddItem("lmud_yaguo","泥潭风云","lmud","http://202.114.98.14/mud/");
menu.AddItem("sperator","","location",null);
menu.AddExtendMenu("lemail","电子邮局","location");
menu.AddItem("email_263","263免费电子邮局","lemail","http://freemail.263.net");
menu.AddExtendMenu("collections","综合性网站","location");
menu.AddItem("coll_chinaren","中国人网站","collections","http://www.chinaren.com/");
menu.AddItem("coll_etang","亿唐网站","collections","http://www.etang.com/");
menu.AddItem("coll_263","263首都在线","collections","http://www.263.net/");
menu.AddExtendMenu("leave","离开","rbpm");
menu.AddItem("forward","前进","leave",null);
menu.AddItem("back","后退","leave",null);
menu.AddItem("sperator","","leave",null);
menu.AddItem("exit","退出","leave",null);
menu.AddItem("viewcode","查看源代码","rbpm",null);
menu.AddItem("refresh","刷新","rbpm",null);
menu.AddItem("sperator","","rbpm",null);
menu.AddItem("help","帮助","rbpm",null);
menu.AddItem("sperator","","rbpm",null);
menu.AddItem("author","<font style='color: #ff0000'>关于作者</font>","rbpm",null);
document.writeln(menu.GetMenu());
snwcwt.innerText=menu.GetMenu();
-->
</
script
>
</
BODY
>
</
HTML
>
绿色通道:
好文要顶
关注我
收藏该文
与我联系
Categories:
网页制作效果
Add your comment
2 条回复
422889
#1楼
风舞影天
2005-05-09 14:18
汗,这个代码我都早不见了-_-;
回复
引用
#2楼
LQ[未注册用户]
2006-06-11 01:33
以前 也见过一次,不过忘了!!呵呵
回复
引用
注册用户登录后才能发表评论,请
登录
或
注册
,
返回博客园首页
。
首页
博问
闪存
新闻
园子
招聘
知识库
最新IT新闻
:
·
乔布斯的音乐情结
·
手机版百度首页推情人节特效,HTML5+CSS3 实现网页3D翻转
·
Groupon将对网站页面重新设计 股价再度破发
·
亚马逊年中将推出8.9寸平板 配四核CPU
·
欧盟无条件批准Google收购摩托罗拉移动
»
更多新闻...
最新知识库文章
:
·
像设计Web程序那样设计建筑
·
向Google学习打造灵动的web体验
·
高级编程语言的发展历程
·
如何学习一门新的编程语言?
·
学习不同编程语言的重要性
»
更多知识库文章...
China-pub 2011秋季教材巡展
China-Pub 计算机绝版图书按需印刷服务
About
本人 QDuck ,男 ,生于 1983年7月4日 ,Mail:82300930@qq.com ,QQ:82300930 (请注明:Blog) ,本人业余时间较多,想接公司的信息化项目来做,保证品质一流。
昵称:
QDuck
园龄:
7年2个月
粉丝:
5
关注:
0
最新评论
Re:用FSO操作 xml
@
兰悦儿
都是在字符串。 -- QDuck
Re:用FSO操作 xml
root,parent,child1,child2,这几个参数要传入什么内容啊? -- 兰悦儿
Re:被逼搞上神经网络这东西!要命啊!?有没同道中人!
同被逼啊!!! -- hailong
Re:从完好的数据文件恢复oracle数据库
以下是一种较好的重建控制文件的方法: 1. 备份数据库中的数据,以防不测。 2. svrmgrl 3. svrmgrl>connect internal 4. svrmgrl>alter ... -- QDuck
Re:今天遇到Oracle审计表AUD$数据过大问题
In metalink, there is an article talking about moving sys.aud$ toanother tablespace.1)create tablesp... -- QDuck
日历
<
2012年2月
>
日
一
二
三
四
五
六
29
30
31
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
1
2
3
4
5
6
7
8
9
10
随笔分类
Rss
0.行业新闻摘要(3)
Rss
1.游戏人生(6)
Rss
2.笑看人生(23)
Rss
3.软件开发---.NET技术(25)
Rss
3.软件开发--AJAX技术(2)
Rss
3.软件开发--ASP技术(46)
Rss
3.软件开发--C Sharp(1)
Rss
3.软件开发--C++编程(1)
Rss
3.软件开发--flash技术进阶(3)
Rss
3.软件开发--JAVASCRIPT 代码收集(37)
Rss
3.软件开发--JSP教程(28)
Rss
3.软件开发--WAP技术(2)
Rss
3.软件开发--XML(1)
Rss
3.软件开发--跟我学XSL(1)
Rss
3.软件开发--网络编程技术(7)
Rss
4.数据库(39)
Rss
5.软件项目管理(1)
Rss
6.系统和服务器问题解决(22)
Rss
8.网络安全(18)
Rss
9.SOE(1)
Rss
9.网络工程(7)
Rss
99.神经网络学习(3)
推荐排行榜
阅读排行榜
持续学习
获得流程
开源站点
CodePlex
CodeProject
DotNetNuke
SourceForge
前端技术
cssglobe
html5demos
raphaeljs js图像,跨浏览器
webdesign
前沿视频教室
友情链接
ADO.NET team blog
Channel9
Haack Blog
MIX
在线资料
CSS ICON
EF教材 Part1
Head First design patterns
JOLT大奖官网
MSSQL TIP
Oracle Library
oracle-base.com
W3C School
WF资料
字库