谁会在页面上加入右建菜单?

xwyliu 2001-12-09 01:05:14
怎样实现在web页上点击页面元素是出现自己定制的菜单项
...全文
170 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
feijunjun 2001-12-18
  • 打赏
  • 举报
回复
http://feijunjun.363.net 上有代码,去下载吧
把代码放在
<body...
<script src="menu.js"></script>
xwyliu 2001-12-18
  • 打赏
  • 举报
回复
怎么给不了
xwyliu 2001-12-18
  • 打赏
  • 举报
回复
好,加倍给分!
wqs0006 2001-12-10
  • 打赏
  • 举报
回复
好!!
bihu 2001-12-09
  • 打赏
  • 举报
回复
效果演示(要点右键呀)
http://www.chinawolf.com/~bihu/down/exam/right_menu.htm
这是一个模仿windows的菜单,你还可以自定义菜单的背景,图片等
插件下载: http://www.tcedu.com.cn/bihu/down/show.php?id=395
seafo 2001-12-09
  • 打赏
  • 举报
回复
给你我在工程中编的例子,20分好像太少了,这可是耗了我8小时的产物
<HTML >
<HEAD>
<TITLE> Hello </TITLE>
<META http-equiv=Pragma content='No-Cache'>
<META content="text/html; charset=GB2312" http-equiv=Content-Type>
<META http-equiv='Cache-Control' content='no-cache,must-revalidate'>
<META http-equiv='Cache-Control' content='no-store'>
<META http-equiv='expires' content='0'>
<style>
.css1{background-color:#003366;color:white}
.css2{background-color:rgb(223,223,223);color:black}
</style>
<script>
/* -------------------------------- 程序加载与卸载 -------------------------------------------------*/


function showMenu(){
event.cancelBubble=true
event.returnValue=false
var e=event.srcElement;
menu.style.posTop=window.event.clientY
menu.style.posLeft=window.event.clientX
if((parseInt(menu.style.left)+parseInt(menu.offsetWidth))>=document.body.clientWidth)
menu.style.left=menu.style.posLeft-menu.offsetWidth+5
if((parseInt(menu.style.top)+parseInt(menu.offsetHeight))>=document.body.clientHeight)
menu.style.top=document.body.clientHeight-menu.offsetHeight
menu.style.visibility='visible';
}

function Add()
{
alert('Add')
}


function Del(){
alert('DEl')}

function Modi(){
alert('Modi')}

function hiddenMenu(){
menu.style.visibility='hidden'
menu.style.left=0
menu.style.top=0
}

function clear(){
var e=event.srcElement
if(e.Ismenu)return true
hiddenMenu();
}

document.onmousedown=clear
document.oncontextmenu=showMenu
</script>
</HEAD>

<BODY>

<div style="padding:4px;position:absolute;left:0;top:0;width:100;background-color:rgb(223,223,223);visibility:hidden;border=1px outset black" id='menu'>
<div onmouseover="this.className='css1'" onmouseout="this.className='css2'" style="width:100%;padding:1px" Ismenu='true' onclick="Add()" id="AddDiv">新建</div>
<div onmouseover="this.className='css1'" onmouseout="this.className='css2'" style="width:100%;padding:1px" Ismenu='true' onclick="Del()" id="DelDiv">删除</div>
<div style="width:100%;height: 1px;border:1px inset gray;overflow:hidden;margin:3px"> </div>
<div onmouseover="this.className='css1'" onmouseout="this.className='css2'" style="width:100%;padding:1px" Ismenu='true' onclick="Modi()" id="EditDiv">修改</div>
</div>

</BODY>
</HTML>
lsaturn 2001-12-09
  • 打赏
  • 举报
回复
我会
懒的写
给你点提示,就是用层,鼠标右键单击时使层可见就可以了。

87,907

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧