100分asp 和 VC++ 高手请进 不够在加分!!!!!

mjs2000 2000-06-15 04:55:00
各位高手请指点:
如何在asp网页中(某些位置)截获鼠标右键的点击事件,并弹出自己的菜单,并实现自己的功能如查询修改等,菜单和asp之间如何传递参数。
...全文
479 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
VictorYu 2000-07-20
  • 打赏
  • 举报
回复
有没有人试出来了, 说句话嘛!
VictorYu 2000-07-16
  • 打赏
  • 举报
回复
关于鼠标右键菜单的问题在几天前刚刚讨论完,在ASP和网页进行不换页的数据交换的问题也有两种方法可以解决.介给你看下面两篇文章第一篇就是右键菜单.可以屏壁IE的右键菜单项。第二篇是介绍不换页的数据交换。如果有问题可以接着问。
http://www.eschool.com.cn/documents/dnyy/wyzhizuo2/0036.shtml
http://www.eschool.com.cn/documents/kfzyd/javascript/jiqiao/y0003.shtml

唯鱼
zigzag 2000-07-14
  • 打赏
  • 举报
回复
上面的例子太长,并没有说清楚。
我提供一个简单的例子。

例子中,用层实现菜单,层先隐藏,当鼠标右键在页面上按下时,在鼠标位置上显示层,按左键时,再将层隐藏。有一点必须注意,层的位置必须固定,即其样式中position:absolute不能少,否则位置无法控制。

<HTML>
<HEAD>
</HEAD>
<script language=jscript>
function showmenu()
{

if(window.event.button==2){
menu.style.left=window.event.clientX;
menu.style.top=window.event.clientY;
menu.style.visibility="visible";
}
}

function hidemenu()
{
menu.style.visibility="hidden";
}</script>
<BODY onmousedown=showmenu() onclick=hidemenu()>

<div id=menu width=100 border=1 style="visibility:hidden;position:absolute">
<table border=1 bgcolor=gray>
<tr>
<td>
<a href="http://www.sohu.com">sohu.com</a><br>
<a href="http://www.sina.com.cn">sina.com.cn</a><br>
<a href="http://www.263.net">263.net</a><br>
<a href="http://www.163.net">163.net</a>
</td>
</tr>
</table>
<div>
</BODY>
</HTML>
wumou 2000-07-14
  • 打赏
  • 举报
回复
这是我以前的一个demo
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title> Web Posting Information </title>
<% Server.ScriptTimeOut = 60 %>
<% Enablesessionstate = true %>
<!--#include virtual="/ADOVBS.inc"-->
<%
Const NumPerPage = 10
Dim CurPage
%>
<style type="text/css">
#m1
{
font-size:12px;
border-color:rgb(0,128,255);
border-style:ridge;
border-width:4px;
position:absolute;
top:10px;
left:5px;
width:500;
background-color:"#C4E0FD";

<%

If Request.Form("curpage") = "" then
CurPage = 1
response.write "clip:rect(0px,0px,0px,0px);"
Else
Curpage = Request.Form("curpage")
response.write "clip:rect(0px,650px,450px,0px);"
End If
%>
}
#m2
{
font-size:48pt;
position:absolute;
top:120px;
left:120px;
}
#m3
{
font-size:13px;
line-height:15px;
border-color:rgb(0,128,255);
border-style:ridge;
border-width:4px;
position:absolute;
top:50px;
left:50px;
width=70px;
height=20px;
visibility:hidden;
background-color:rgb(255,255,255);
}
#m4
{
border-color:rgb(0,128,255);
border-style:ridge;
border-width:4px;
position:absolute;
top:50px;
left:50px;
width=150px;
visibility:hidden;
background-color:rgb(255,255,255);

}
</style>
<script Language="JavaScript">
var x = 0;
var x_offset =-5;
var y = 0;
var y_offset = -10;
var ptcX=0;
var ptcY=0;
var ptcW=0;
var ptcH=0;
var onshow="m3";

document.onmousedown = get_mouse;

function get_mouse(e)
{
x = event.clientX+document.body.scrollLeft;
y = event.clientY+document.body.scrollTop;
x += x_offset;
y += y_offset;
if (onshow !="")
{ obj=document.all[onshow].style;
if (x<ptcX || x>ptcX+ptcW || y<ptcY || y>ptcY+ptcH)
{
obj.visibility="hidden";
}
}
}


function moveit(name,t,tow,toh,too,fx)
{
var obj=document.all[name].style

if (obj.visibility=="hidden")obj.visibility="visible"

if (fx==1)
{document.all[name].style.clip="rect(0px,"+tow*t/too+"px,"+toh*t/too+"px,0px)"}
else
{
var tttw= tow*t/too
var ttth= toh*t/too
document.all[name].style.clip="rect("+tttw+"px,"+tow+"px,"+toh+"px,"+ttth+"px)"
}
t++
if(t<=too)
{
ls="moveit('m1',"+t+","+tow+","+toh+","+too+","+fx+")"
setTimeout(ls,1)
}

}
function gotopage()
{
document.frmList1.selzh.value=''
document.frmList1.curpage.value=''
document.frmList1.act.value="";
document.frmList1.submit()
}

function hideit(name)
{
document.all[name].style.visibility="hidden"

}
function showmenu(zh)
{
document.all["m4"].style.visibility="hidden"
document.all["m3"].style.top=y
document.all["m3"].style.left=x
document.all["m3"].style.visibility="visible";
ptcX=x;
ptcY=y;
ptcW=70;
ptcH=69;
document.frmList1.selzh.value=zh;
onshow="m3";
}
function querydel()
{
document.all["m3"].style.visibility="hidden"
document.all["m4"].style.visibility="visible"
document.all["m4"].style.top=y-40
document.all["m4"].style.left=x-50
ptcX=x-50
ptcY=y-40
ptcW=150;
ptcH=60;
onshow="m4";
}
function cancelsel()
{
ptcX=0
ptcY=0
ptcW=0;
ptcH=0;
document.all[onshow].style.visibility="hidden";
onshow="";
}
function the_url(now_page,act)
{
document.frmList1.curpage.value=now_page;
document.frmList1.act.value=act;

document.frmList1.submit()
}
function img_style(zh,i_t)
{
document.frmList1.theimg.filters.item(0).Apply()
ls="Binwchrt.asp?zh="+"20502000585"+"&i_t="&'1'
document.frmList1.theimg.src="Binwchrt.asp?zh="+zh+"&i_t="+i_t
document.frmList1.theimg.filters.item(0).Play()
}
</script>
</head>

<body bgcolor="#C4E0FD" style="font-size:10pt">
<a href="javascript:moveit('m1',1,650,650,20,1)">ggggg</a>
<div id="m2">
sgasggfgdfgdafgaf fhafhafhasdfas
</div>
<div id="m1">
<div id="m3">
<a href="javascript:the_url(<%response.write curpage%>,'promodi')">修改</a><br>
<a href="javascript:querydel()">删除</a><br>
<a href="javascript:the_url(<%response.write curpage%>,'chart')">图表</a><br>
<a href="javascript:the_url(<%response.write curpage%>,'prokhzl')">客户资料</a><br>
</div>
<div id="m4">
<p>是否确认删除?
<p><a href="javascript:the_url(<%response.write curpage%>,'del')">是</a>  <a href="javascript:cancelsel()">否</a>
</div>
<a href="javascript:moveit('m1',1,650,650,20,-1)">ggggg</a>
<form name="frmList1" method="post" action="w2.asp" style="font-size:12pt">
<input type="hidden" name="act" value="<%response.write Request.Form("act")%>">
<input type='hidden' name='selzh' value="<%response.write Request.Form("selzh")%>">
<%
on error resume next
set con=Server.CreateObject("ADODB.Connection")
con.open "DSN=fgk;Usa=czdsf;password=czsf12"
Set RS=Server.CreateObject("ADODB.Recordset")

If Request.Form("act") = "del" then
Err.Clear
ls="delete from tb111 where fb11zh="&Request.Form("selzh")
con.execute ls,,adCmdText
if Err.number<>0 then
RESPONSE.write "<input type='hidden' name='curpage'>"

response.write ls&"<p>"
response.write "err="& Err.Description&"<p> "
Response.Write("<a href=""javascript:the_url("&CInt(curpage)&",'')"">返回</a>")
end if
end if

if Request.Form("act") = "promodi" then
err.Clear
Rs.Open "select fb11dwm from tb11 where fb11zh="&Request.Form("selzh"),Con
%>
<input type=text name="fb11dwm" size=60 value='<%response.write RS("fb11dwm")%>'><p>
<input type='hidden' name='curpage' value=<%response.write curpage%>>
<a href="javascript:the_url(<%response.write curpage%>,'modi')"">修改</a>

<%
Response.Write("<a href=""javascript:the_url("&CInt(curpage)&",'')"">返回</a>")
end if
if Request.Form("act") = "prokhzl" then
err.Clear
Rs.Open "select fb11khzl from tb11 where fb11zh="&Request.Form("selzh"),Con
nFieldSize = RS("fb11khzl").ActualSize
bytes = rs("fb11kjhzl").GetChunk(nFieldSize)
%>
<input type='hidden' id=ykhzl value='<%response.write bytes%>'>
<textarea name="fb11khzl" DATASRC=ykhzl ROWS=10 ></textarea><p>
<input type='hidden' name='curpage' value=<%response.write curpage%>>
<a href="javascript:the_url(<%response.write curpage%>,'khzl')"">修改</a>
<%
Response.Write("<a href=""javascript:the_url("&CInt(curpage)&",'')"">返回</a>")
end if
if Request.Form("act") = "chart" then
%>
<input type='hidden' name='curpage' value=<%response.write curpage%>>
<a href="javascript:img_style(<%response.write Request.Form("selzh")%>,1)">柱图</a>
<a href="javascript:img_style(<%response.write Request.Form("selzh")%>,5)">线图</a>
<a href="javascript:img_style(<%response.write Request.Form("selzh")%>,3)">饼图</a> <br>

<img id="theimg" src="Binwchrt.asp?zh=<%response.write Request.Form("selzh")%>&i_t=5"
style="filter:revealTrans(Duration=0.5,Transition=12)"><br>
<%
Response.Write("<a href=""javascript:the_url("&CInt(curpage)&",'')"">返回</a>")
end if
if Request.Form("act") = "modi" then
Err.Clear
ls="update tb11 set fb11dwm='"&Request.Form("fb11dwm")&"' where fb11zh='"&Request.Form("selzh")&"'"
con.execute ls,,adCmdText
if Err.number<>0 then
%> <input type='hidden' name='curpage' value=<%response.write curpage%>>
<% response.write ls&"<p>"
response.write "err="& Err.Description&"<p> "
Response.Write("<a href=""javascript:the_url("&CInt(curpage)&",'')"">返回</a>")
end if
end if
if Request.Form("act") = "khzl" then
Err.Clear
ls="select * tb11 where fb11zh='"&Request.Form("selzh")&"'"
rs.CursorType = adOpenKeyset
rs.LockType = adLockOptimistic
rs.open ls,con

rs.fb11khzl.AppendChunk request.form("fb11khzl")
rs.update()
if Err.number<>0 then
%> <input type='hidden' name='curpage' value=<%response.write curpage%>>
<% response.write ls&"<p>"
response.write "err="& Err.Description&"<p> "
Response.Write("<a href=""javascript:the_url("&CInt(curpage)&",'')"">返回</a>")
end if
end if
if Err.number=0 and Request.Form("act") <> "promodi" and Request.Form("act") <> "prokhzl" and Request.Form("act") <> "chart" then
Set RS1=Server.CreateObject("ADODB.Recordset")
rs.maxrecords=NumPerPage*CurPage
rs.Cursortype= adOpenStatic
rs.CursorLocation = adUseClient
RS1.open "select count(fb11zh) cc from tb11",con
Rs.Open "select fb11zh,fb11dwm from tb11 order by fb11zh",Con
rs.PageSize = NumPerPage
TotalPages =Rs1("cc")
if(cInt(TotalPages) mod NumPerPage)=0 then
TotalPages= ( cInt(TotalPages) - (cInt(TotalPages) mod NumPerPage))/NumPerPage
else
TotalPages= ( cInt(TotalPages) - (cInt(TotalPages) mod NumPerPage))/NumPerPage+1
end if
rs.AbsolutePage = cint(CurPage)
%>
<input type="text" name="curpage" size="5" value="<%response.write curpage%>"> <input type="button" value=" goto "
language="javascript" onclick="gotopage()" name="button1"> <br>
</form>
<form name="mytable" >
<table border="1" width="100%" bgcolor="#FDDBC4" style="font-size:13px">
<tr>
<th width="35%">帐号</th>
<th width="55%">名称</th>
</tr>
<%
Count = 0
Do While Not rs.EOF And Count < NumPerPage %>
<tr>
<td width="15%"><a href='javascript:showmenu(<%response.write RS("fb11zh")%>)'><%response.write RS("fb11zh")%></a></td>
<td width="30%"><%Response.write RS("fb11dwm")%></td>
</tr>
<% Count = Count + 1
rs.MoveNext
Loop
%>
</table>
</form>
<%
Response.Write("第 " & CurPage & " 页,共 " & TotalPages & "页<br>")

if CurPage > 1 then
Response.Write "<a href=""javascript:the_url("&CInt(curpage)-1&",'')"">前一页</a>"
End If

if CInt(CurPage) <> CInt(TotalPages) then
%>
<a href="javascript:the_url(<%Response.write CInt(curpage)+1%>,'')">后一页</a>
<% end if
%>
<form name=frmtoe method=post action="ToExcelBySrv.asp" target="_blank">
<input name=tHtml type=hidden Value="">
<input type=button value="to excel" onclick="document.frmtoe.tHtml.value=document.mytable.innerHTML;document.frmtoe.submit();">
</form>
<%end if%>
</div>
</body>
</html>
waynezlee 2000-06-19
  • 打赏
  • 举报
回复
pop菜单可以用 隐藏的Div
if (event.button==2 ||event.button==3) //响应鼠标右键
{
处理隐藏Div的leftX和topY;
显示隐藏的Div;
}
cjlong 2000-06-16
  • 打赏
  • 举报
回复
我想出的办法是:
1。<HEAD>
document.onmousedown = 你的响应鼠标消息的JavaScript函数
</HEAD>
2。在网页上定义一个层,菜单的内容放置在层中,将层的可视性设为false。
3。在你的响应鼠标消息的JavaScript函数中,侦知鼠标的位置,将层的可视性设为trun。
true_hero 2000-06-16
  • 打赏
  • 举报
回复
如果你截获document.onmousedown 在右键中屏蔽系统菜单(直接返回),在屏蔽之前,把一个有菜单样子的iframe在鼠标位置显示出来,
也就是把我们通常所作的网页上的下拉菜单变成一个pop菜单,并在鼠标位置显现,然后屏蔽系统菜单,总之,你还是要用一个在网页中的菜单,虽然这和系统菜单不是一个性质,但从视觉和感受上差不多,而且可以更漂靓
dudo 2000-06-16
  • 打赏
  • 举报
回复
在网景浏览器 你可这样处理:
举例如下:
<script language="javascript">
function eventhander(){

调用event内置对象属性
}
</script>
event 对象有如下属性:
type 指示事件类型;
layerX 相对当前层的水平位置;
layerY 相对当前层的垂直位置;
pageX
pageY
screenX
screenY
which 鼠标按键信息,1,左键,3,右键;
modifiers 同时按下的键盘键控制键 alt_mask,control_mask,shift_mask

由于在ie中没有实现event对象,所以不能直接使用event对象,可这样实现:
<script language="javascript">
function eventhander(e){

// e将被实例化event对象,
document.writeln("目前水平位置:"+e.layerX)
}
</script>
上面的代码都写在head段,在head段最后加上
document.onmousedown=事件处理函数eventhander()
mjs2000 2000-06-16
  • 打赏
  • 举报
回复
To ring
请具体的说一下
mjs2000 2000-06-16
  • 打赏
  • 举报
回复
请大家来讨论一下
我又加了50分不够在加
Un1 2000-06-16
  • 打赏
  • 举报
回复
Scriptlet有raiseEvent和setContextMenu应该可以实现吧?!(我没做过)
ring 2000-06-15
  • 打赏
  • 举报
回复
用dhtml
mjs2000 2000-06-15
  • 打赏
  • 举报
回复
to whq
能否实现加菜单呢?
你想过没有如不控制系统(ie)能够实现吗?
我只是一种想象如果能够实现我们就可以把我们的网页做的更好啊
希望大家多发表自己的见解
WHQ 2000-06-15
  • 打赏
  • 举报
回复
<HEAD>
document.onmousedown = 你的响应鼠标消息的JavaScript函数
</HEAD>
某个区域加鼠标消息你可看JAVASCRIPT的手册。加菜单我就不会了
mjs2000 2000-06-15
  • 打赏
  • 举报
回复
谢谢ghj1976最好快点啊
蝈蝈俊 2000-06-15
  • 打赏
  • 举报
回复
看看吧

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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