首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

ASP.NET中奇怪的IE自定义右键菜单有关问题,请高手解答!

2012-01-29 
ASP.NET中奇怪的IE自定义右键菜单问题,请高手解答!!我在网上下了一个IE自定义右键菜单的JS代码menu0.js//J

ASP.NET中奇怪的IE自定义右键菜单问题,请高手解答!!
我在网上下了一个IE自定义右键菜单的JS代码menu0.js
//   JavaScript   Document

var   strMenu   =   " <div   id=\ "menu\ "   class=\ "clsMenu\ "   onMouseover=\ "highlight()\ "   onMouseout=\ "lowlight()\ "> "
strMenu   +=   " <div   class=\ "menuitems\ "   onClick=\ "javascript:history.back()\ "> ·&micro;&raquo;&Oslash; </div> "
strMenu   +=   " <div   class=\ "menuitems\ "   onClick=\ "javascript:history.forward()\ "> &Ccedil;°&frac12;&oslash; </div> "
strMenu   +=   " <div   class=\ "menuitems\ "   onClick=\ "javascript:location.reload()\ "> &Euml;&cent;&ETH;&Acirc; </div> "
strMenu   +=   " <div   class=\ "menuitems\ "   onClick=\ "javascript:print()\ "> &acute;ò&Oacute;&iexcl; </div> "

strMenu   +=   " <hr   color=#999999   size=1> "
strMenu   +=   " <div   class=\ "menuitems\ "   onClick=\ "javascript:location.href= 'index.html '\ "> &Iuml;&micro;&Iacute;&sup3;&Ecirc;×&Ograve;&sup3; </div> "
strMenu   +=   " <div   class=\ "menuitems\ "   onClick=\ "javascript:location.href= 'map.html '\ "> &Iuml;&micro;&Iacute;&sup3;°&iuml;&Ouml;ú </div> "
//strMenu   +=   " <div   class=\ "menuitems\ "   onClick=\ "javascript:location.href= 'feedback.html '\ "> D??&iexcl;é&iexcl;¤&iexcl;&auml;¨¤? </div> "
//strMenu   +=   " <div   class=\ "menuitems\ "   onClick=\ "javascript:location.href= 'job.html '\ "> 3???¨&reg;&iexcl;é2? </a> </div> "

strMenu   +=   " <div   class=\ "menuitems\ "   onClick=\ "javascript:location.href= 'mailto:scutde@21cn.com '\ "> &Aacute;&ordf;&Iuml;&micro;&Icirc;&Ograve;&Atilde;&Ccedil; </a> </div> "
strMenu   +=   " <div   class=\ "menuitems\ "   onClick=\ "javascript:location.href= 'law.html '\ "> &Iacute;&Euml;&sup3;&ouml;&Iuml;&micro;&Iacute;&sup3; </a> </div> "
strMenu   +=   " </div> "

function   ie()   {
if   (navigator.appName== "Microsoft   Internet   Explorer ")   {
return   true;
}   else   {
return   false;
}}

function   showmenu(){
if   (ie()){

var   rightedge=document.body.clientWidth-event.clientX
var   bottomedge=document.body.clientHeight-event.clientY


if   (rightedge <menu.offsetWidth)
menu.style.left=document.body.scrollLeft+event.clientX-menu.offsetWidth
else

menu.style.left=document.body.scrollLeft+event.clientX


if   (bottomedge <menu.offsetHeight)
menu.style.top=document.body.scrollTop+event.clientY-menu.offsetHeight
else
menu.style.top=document.body.scrollTop+event.clientY

menu.style.visibility= "visible "
}
return   false
}


function   hidemenu(){
if   (ie())   menu.style.visibility= "hidden "


}


function   highlight(){
if   (event.srcElement.className== "menuitems "){
event.srcElement.style.backgroundColor= "#FFD112 "
event.srcElement.style.color= "#000000 "
}}


function   lowlight(){
if   (event.srcElement.className== "menuitems "){
event.srcElement.style.backgroundColor= " "
event.srcElement.style.color= "menutext "
}}

if   (ie())   document.write   (strMenu);
document.oncontextmenu=   showmenu
document.body.onclick=   hidemenu


在如下一个HTML文件中调用,能正常显示并工作:
<!DOCTYPE   HTML   PUBLIC   "-//W3C//DTD   HTML   4.0   Transitional//EN ">
<!--   saved   from   url=(0031)http://www.hnjk.com.cn/map.html   -->
<HTML> <HEAD> <TITLE> </TITLE> <LINK  
href= "main.css "   type=text/css   rel=stylesheet>
<META   http-equiv=Content-Type   content= "text/html;   charset=gb2312 ">
<META   content= "MSHTML   6.00.3790.2817 "   name=GENERATOR> </HEAD>
<BODY>
<SCRIPT   language=JavaScript   src= "menu0.js ">                          
</SCRIPT>
</BODY> </HTML>

main.css文件如下:
INPUT   {
BORDER-TOP-WIDTH:   1px;   PADDING-RIGHT:   1px;   PADDING-LEFT:   1px;   BORDER-LEFT-WIDTH:   1px;   FONT-SIZE:   9pt;   BORDER-LEFT-COLOR:   #cccccc;   BORDER-BOTTOM-WIDTH:   1px;   BORDER-BOTTOM-COLOR:   #cccccc;   PADDING-BOTTOM:   1px;   BORDER-TOP-COLOR:   #cccccc;   PADDING-TOP:   1px;   FONT-FAMILY:   &Euml;&Icirc;&Igrave;&aring;,   Arial,   Helvetica;   HEIGHT:   18px;   BACKGROUND-COLOR:   #b0b2a2;   BORDER-RIGHT-WIDTH:   1px;   BORDER-RIGHT-COLOR:   #cccccc
}
BODY   {
SCROLLBAR-HIGHLIGHT-COLOR:   buttonface;   SCROLLBAR-SHADOW-COLOR:   buttonface;   SCROLLBAR-3DLIGHT-COLOR:   buttonhighlight;   SCROLLBAR-TRACK-COLOR:   #eeeeee;   SCROLLBAR-DARKSHADOW-COLOR:   buttonshadow;   font-color:   #000066
}
.p10   {
FONT-SIZE:   10.5pt
}
.p9   {
FONT-SIZE:   9pt;   PADDING-BOTTOM:   5px;   LINE-HEIGHT:   150%;   PADDING-TOP:   5px
}
.text   {
FONT-SIZE:   9pt;   FILTER:   DropShadow(Color=#f5f5f5,   OffX=1,   OffY=1,   Positive=1)
}
TD.menu   {
BACKGROUND:   #7d86aa
}
TD   {
FONT-SIZE:   9pt;   LINE-HEIGHT:   150%
}
.clsMenu   {
BORDER-RIGHT:   buttonhighlight   1px   outset;   BORDER-TOP:   buttonhighlight   1px   outset;   VISIBILITY:   hidden;   BORDER-LEFT:   buttonhighlight   1px   outset;   WIDTH:   100px;   CURSOR:   default;   COLOR:   #000000;   BORDER-BOTTOM:   buttonhighlight   1px   outset;   POSITION:   absolute;   BACKGROUND-COLOR:   #f5f5f5
}
.menuitems   {
PADDING-RIGHT:   10px;   PADDING-LEFT:   20px;   FONT-SIZE:   12px;   COLOR:   #333333;   LINE-HEIGHT:   18px
}
.form1   {
FONT-SIZE:   9pt;   BORDER-BOTTOM:   #cccccc   1px   solid
}
.form2   {


FONT-SIZE:   9pt;   BORDER-BOTTOM:   #999999   1px   solid
}
.form3   {
BORDER-RIGHT:   #999999   1px   solid;   FONT-SIZE:   9pt
}
.form4   {
BORDER-TOP:   #cccccc   1px   solid;   FONT-SIZE:   9pt;   BORDER-BOTTOM:   #cccccc   1px   solid
}
.form5   {
BORDER-TOP:   #cccccc   1px   solid;   FONT-SIZE:   9pt
}
.form6   {
FONT-SIZE:   10.5pt;   BORDER-BOTTOM:   #999999   1px   solid
}
.IN   {
BORDER-TOP-WIDTH:   1px;   PADDING-RIGHT:   1px;   PADDING-LEFT:   1px;   BORDER-LEFT-WIDTH:   1px;   FONT-SIZE:   9pt;   BORDER-LEFT-COLOR:   #cccccc;   BORDER-BOTTOM-WIDTH:   1px;   BORDER-BOTTOM-COLOR:   #cccccc;   PADDING-BOTTOM:   1px;   BORDER-TOP-COLOR:   #cccccc;   PADDING-TOP:   1px;   FONT-FAMILY:   &Euml;&Icirc;&Igrave;&aring;,   Arial,   Helvetica;   HEIGHT:   18px;   BACKGROUND-COLOR:   #ffffff;   BORDER-RIGHT-WIDTH:   1px;   BORDER-RIGHT-COLOR:   #cccccc
}
.form   {
BORDER-RIGHT:   #000000   1px   solid;   BORDER-TOP:   #000000   1px   solid;   FONT-SIZE:   9pt;   BORDER-LEFT:   #000000   1px   solid;   BORDER-BOTTOM:   #000000   1px   solid;   BACKGROUND-COLOR:   white
}

可是不知道为什么我一放到aspx页面中照上面的方式调用就不能正常显示了
郁闷啊

不知道我讲清楚没
请高手们解答一下
帮帮偶..
在此感谢大家了

[解决办法]
有错误还是效果出不来?
[解决办法]
奇怪的问题,帮顶

热点排行