<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>自定义鼠标右键弹出式菜单</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<STYLE type=text/css>.div1 {
BORDER-RIGHT: windowframe 1px solid; BORDER-TOP: buttonface 1px solid; BORDER-LEFT: buttonface 1px solid; BORDER-BOTTOM: windowframe 1px solid
}
.div2 {
BORDER-RIGHT: buttonshadow 1px solid; BORDER-TOP: window 1px solid; BORDER-LEFT: window 1px solid; BORDER-BOTTOM: buttonshadow 1px solid
}
.MouseOver {
FONT-SIZE: 12px; CURSOR: hand; COLOR: highlighttext; BACKGROUND-COLOR: highlight
}
.MouseOut {
FONT-SIZE: 12px; CURSOR: default; COLOR: buttontext; BACKGROUND-COLOR: buttonface
}
</STYLE><SCRIPT language=javascript>
function PopupMouseRightButtonUpMenu()
{
if(MouseMenu.style.visibility=='visible') MouseMenu.style.visibility='hidden';
if (event.srcElement.tagName=='A' || event.srcElement.tagName=='TEXTAREA' || event.srcElement.tagName=='INPUT' || document.selection.type!='None')
return true;
else
{
if (event.clientX+150 > document.body.clientWidth) MouseMenu.style.left=event.clientX+document.body.scrollLeft-150;
else MouseMenu.style.left=event.clientX+document.body.scrollLeft;
if (event.clientY+DivH > document.body.clientHeight) MouseMenu.style.top=event.clientY+document.body.scrollTop-DivH;
else MouseMenu.style.top=event.clientY+document.body.scrollTop;
MouseMenu.style.visibility='visible';
}
return false;
}
function DrawMouseRightButtonUpMenu(){
DivH=2;
//oSelection = document.selection;
var HrStr='<tr><td align=\"center\" valign=\"middle\" height=\"2\"><TABLE border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"128\" height=\"2\"><tr><td height=\"1\" bgcolor=\"buttonshadow\"><\/td><\/tr><tr><td height=\"1\" bgcolor=\"buttonhighlight\"><\/td><\/tr><\/TABLE><\/td><\/tr>';
var MenuItemStr1='<tr><td align=\"center\" valign=\"middle\" height=\"20\"><TABLE border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"132\"><tr><td valign=\"middle\" height=\"16\" class=\"MouseOut\" onMouseOver=\"this.className=\'MouseOver\'\" onMouseOut=\"this.className=\'MouseOut\'\" onclick=\"'
var MenuItemStr2="<\/td><\/tr><\/TABLE><\/td><\/tr>";
var historyMenu=['window.history.back()\">后退','window.history.forward()\">前进'];
var SysMenu=['\">查找 <INPUT TYPE=\"text\" Size=\"10\" onkeypress=\"if (event.keyCode == 13) {MouseMenu.style.visibility=\'hidden\';var temp = this.value; this.value = \'\';return findInPage(temp)}\";\'>',
'document.execCommand(\'SelectAll\')\">全选',
'MouseMenu.style.visibility=\'hidden\';document.execCommand(\'SaveAs\',\'true\')\">另存为 ...',
'location.replace(\'view-source:\'+location.href)\">查看源文件',
'MouseMenu.style.visibility=\'hidden\';window.print()\">打印',
'window.location.reload()\">刷新'];var MenuStr='';
for(i=0;i<historyMenu.length;i++)
{
MenuStr+=MenuItemStr1+historyMenu[i]+MenuItemStr2;
DivH+=20;
}
MenuStr+=HrStr;
for(i=0;i<arguments.length;i++)
{
MenuStr+=MenuItemStr1+arguments[i]+MenuItemStr2;
DivH+=20;
}if(arguments.length>0)
{
MenuStr+=HrStr;
DivH+=2;
}for(i=0;i<SysMenu.length;i++)
{
MenuStr+=MenuItemStr1+SysMenu[i]+MenuItemStr2;
DivH+=20;
}var aboutMenu=['MouseMenu.style.visibility=\'hidden\';alert(\'http:\/\/www.playyuer.com\\nmailto:[email protected]\')">关于 ...']
MenuStr+=HrStr;
for(i=0;i<aboutMenu.length;i++)
{
MenuStr+=MenuItemStr1+aboutMenu[i]+MenuItemStr2;
DivH+=20;
}var MenuTop = '<DIV id=\"MouseMenu\" class=\"div1\" style=\"position:absolute; left:0px; top:0px; width=150;height='+DivH+'; z-index:1; visibility:hidden;\">\n' +
'<TABLE border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"div2\">\n' +
'<tr>\n' +
'<td bgcolor=\"' + MenuBarColor+ '\" width=\"50\" valign=\"bottom\" align=\"center\" bgcolor=\"buttonface\">\n' +
'<\/td>\n'+
'<td bgcolor=\"buttonface\">\n'+
'<TABLE border=\"0\" cellpadding=\"0\" cellspacing=\"0\">';
var MenuBottom = '<\/TABLE><\/td><\/tr><\/TABLE><\/DIV>';
document.write(MenuTop+MenuStr+MenuBottom);
//prompt('aa',MenuTop+MenuStr+MenuBottom)
document.body.oncontextmenu=new Function('return PopupMouseRightButtonUpMenu();');
document.body.onclick=new Function('if(event.srcElement.tagName !=\'INPUT\') MouseMenu.style.visibility=\'hidden\'');
document.body.onscroll=new Function('MouseMenu.style.visibility=\'hidden\';');
document.body.onselectstart=new Function('MouseMenu.style.visibility=\'hidden\';');
window.onresizestart=new Function('MouseMenu.style.visibility=\'hidden\';');
}
var NS4 = (document.layers);
var IE4 = (document.all);
var win = window;
var n = 0;
function findInPage(str) {
var txt, i, found;
if (str == '')
return false;
if (NS4) {
if (!win.find(str))
while(win.find(str, false, true))
n++;
else
n++;
if (n == 0)
alert('文档搜索完毕。');
}
if (IE4) {
txt = win.document.body.createTextRange();
for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
txt.moveStart('character', 1);
txt.moveEnd('textedit');
}
if (found) {
txt.moveStart('character', -1);
txt.findText(str);
txt.select();
txt.scrollIntoView();
n++;
}
else {
if (n > 0) {
n = 0;
findInPage(str);
}
else
alert('文档搜索完毕。');
}
}
return false;
}
</SCRIPT><META content="MSHTML 6.00.2600.0" name=GENERATOR></HEAD>
<BODY>自定义鼠标右键弹出式菜单
<SCRIPT language=JavaScript>
<!--
var MenuBarColor ='#6600FF';
DrawMouseRightButtonUpMenu();
//-->
</SCRIPT>
</BODY></HTML>
<HTML><HEAD><TITLE>自定义鼠标右键弹出式菜单</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<STYLE type=text/css>.div1 {
BORDER-RIGHT: windowframe 1px solid; BORDER-TOP: buttonface 1px solid; BORDER-LEFT: buttonface 1px solid; BORDER-BOTTOM: windowframe 1px solid
}
.div2 {
BORDER-RIGHT: buttonshadow 1px solid; BORDER-TOP: window 1px solid; BORDER-LEFT: window 1px solid; BORDER-BOTTOM: buttonshadow 1px solid
}
.MouseOver {
FONT-SIZE: 12px; CURSOR: hand; COLOR: highlighttext; BACKGROUND-COLOR: highlight
}
.MouseOut {
FONT-SIZE: 12px; CURSOR: default; COLOR: buttontext; BACKGROUND-COLOR: buttonface
}
</STYLE><SCRIPT language=javascript>
function PopupMouseRightButtonUpMenu()
{
if(MouseMenu.style.visibility=='visible') MouseMenu.style.visibility='hidden';
if (event.srcElement.tagName=='A' || event.srcElement.tagName=='TEXTAREA' || event.srcElement.tagName=='INPUT' || document.selection.type!='None')
return true;
else
{
if (event.clientX+150 > document.body.clientWidth) MouseMenu.style.left=event.clientX+document.body.scrollLeft-150;
else MouseMenu.style.left=event.clientX+document.body.scrollLeft;
if (event.clientY+DivH > document.body.clientHeight) MouseMenu.style.top=event.clientY+document.body.scrollTop-DivH;
else MouseMenu.style.top=event.clientY+document.body.scrollTop;
MouseMenu.style.visibility='visible';
}
return false;
}
function DrawMouseRightButtonUpMenu(){
DivH=2;
//oSelection = document.selection;
var HrStr='<tr><td align=\"center\" valign=\"middle\" height=\"2\"><TABLE border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"128\" height=\"2\"><tr><td height=\"1\" bgcolor=\"buttonshadow\"><\/td><\/tr><tr><td height=\"1\" bgcolor=\"buttonhighlight\"><\/td><\/tr><\/TABLE><\/td><\/tr>';
var MenuItemStr1='<tr><td align=\"center\" valign=\"middle\" height=\"20\"><TABLE border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"132\"><tr><td valign=\"middle\" height=\"16\" class=\"MouseOut\" onMouseOver=\"this.className=\'MouseOver\'\" onMouseOut=\"this.className=\'MouseOut\'\" onclick=\"'
var MenuItemStr2="<\/td><\/tr><\/TABLE><\/td><\/tr>";
var historyMenu=['window.history.back()\">后退','window.history.forward()\">前进'];
var SysMenu=['\">查找 <INPUT TYPE=\"text\" Size=\"10\" onkeypress=\"if (event.keyCode == 13) {MouseMenu.style.visibility=\'hidden\';var temp = this.value; this.value = \'\';return findInPage(temp)}\";\'>',
'document.execCommand(\'SelectAll\')\">全选',
'MouseMenu.style.visibility=\'hidden\';document.execCommand(\'SaveAs\',\'true\')\">另存为 ...',
'location.replace(\'view-source:\'+location.href)\">查看源文件',
'MouseMenu.style.visibility=\'hidden\';window.print()\">打印',
'window.location.reload()\">刷新'];var MenuStr='';
for(i=0;i<historyMenu.length;i++)
{
MenuStr+=MenuItemStr1+historyMenu[i]+MenuItemStr2;
DivH+=20;
}
MenuStr+=HrStr;
for(i=0;i<arguments.length;i++)
{
MenuStr+=MenuItemStr1+arguments[i]+MenuItemStr2;
DivH+=20;
}if(arguments.length>0)
{
MenuStr+=HrStr;
DivH+=2;
}for(i=0;i<SysMenu.length;i++)
{
MenuStr+=MenuItemStr1+SysMenu[i]+MenuItemStr2;
DivH+=20;
}var aboutMenu=['MouseMenu.style.visibility=\'hidden\';alert(\'http:\/\/www.playyuer.com\\nmailto:[email protected]\')">关于 ...']
MenuStr+=HrStr;
for(i=0;i<aboutMenu.length;i++)
{
MenuStr+=MenuItemStr1+aboutMenu[i]+MenuItemStr2;
DivH+=20;
}var MenuTop = '<DIV id=\"MouseMenu\" class=\"div1\" style=\"position:absolute; left:0px; top:0px; width=150;height='+DivH+'; z-index:1; visibility:hidden;\">\n' +
'<TABLE border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"div2\">\n' +
'<tr>\n' +
'<td bgcolor=\"' + MenuBarColor+ '\" width=\"50\" valign=\"bottom\" align=\"center\" bgcolor=\"buttonface\">\n' +
'<\/td>\n'+
'<td bgcolor=\"buttonface\">\n'+
'<TABLE border=\"0\" cellpadding=\"0\" cellspacing=\"0\">';
var MenuBottom = '<\/TABLE><\/td><\/tr><\/TABLE><\/DIV>';
document.write(MenuTop+MenuStr+MenuBottom);
//prompt('aa',MenuTop+MenuStr+MenuBottom)
document.body.oncontextmenu=new Function('return PopupMouseRightButtonUpMenu();');
document.body.onclick=new Function('if(event.srcElement.tagName !=\'INPUT\') MouseMenu.style.visibility=\'hidden\'');
document.body.onscroll=new Function('MouseMenu.style.visibility=\'hidden\';');
document.body.onselectstart=new Function('MouseMenu.style.visibility=\'hidden\';');
window.onresizestart=new Function('MouseMenu.style.visibility=\'hidden\';');
}
var NS4 = (document.layers);
var IE4 = (document.all);
var win = window;
var n = 0;
function findInPage(str) {
var txt, i, found;
if (str == '')
return false;
if (NS4) {
if (!win.find(str))
while(win.find(str, false, true))
n++;
else
n++;
if (n == 0)
alert('文档搜索完毕。');
}
if (IE4) {
txt = win.document.body.createTextRange();
for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
txt.moveStart('character', 1);
txt.moveEnd('textedit');
}
if (found) {
txt.moveStart('character', -1);
txt.findText(str);
txt.select();
txt.scrollIntoView();
n++;
}
else {
if (n > 0) {
n = 0;
findInPage(str);
}
else
alert('文档搜索完毕。');
}
}
return false;
}
</SCRIPT><META content="MSHTML 6.00.2600.0" name=GENERATOR></HEAD>
<BODY>自定义鼠标右键弹出式菜单
<SCRIPT language=JavaScript>
<!--
var MenuBarColor ='#6600FF';
DrawMouseRightButtonUpMenu();
//-->
</SCRIPT>
</BODY></HTML>
解决方案 »
- 关于jqgrid 3.5中del 的 url 问题如下:
- 偶然发现[在任何浏览器上都可以使用fire bug]真是兴奋。
- js自动触发onclick,ie有效
- 高手帮我看看
- 谁能帮忙修改这段代码在firefox下用,谢谢
- form表单提交后的页面如何阻止弹出窗口?谢谢
- 请教各位!
- 这是为什么?(弹出窗口返回值问题)
- 高手快进!!!
- 我要类似 http://jqueryui.com/tabs/#sortable 他时标签 能调整顺序 但也能添加删除标签 修改
- 100分,如何做点击右键表格单元格的任意位置弹出自己做的菜单!!!!!
- 100分高手请指教:Netscape4.X和javascript难题!
而我想得到的只是把当前页面的URL传给应用程序呀!
2,在当前页面的任何地方右键点击“WEBSAVE”,启动应用程序。并把此页面的URL做为参数传递给应用程序。最重要的就是想得到当前页面的URL。这样我的主程序才可以下载该页面呀!
这好像比网络蚂蚁一类的还简单点吧!:)呵呵!
谢谢!请帮助!
70分全部相送!!!!!!