不说了....直接上码!!!! 这是前台:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页 </title>
<script type="text/javascript" src="JScript.js"> </script>
</head>
<body oncontextmenu="showmenu(); return false;" onclick="hiddmenu();">
<form id="form1" runat="server">
<div id="vv" style=" position:absolute; visibility:hidden; border-right: 2px outset; border-top: 2px outset; font-weight: lighter;
font-size: 9pt; border-left: 2px outset; border-bottom: 2px outset;
width:100px; height:100px; background-color: menu">
<span onclick="window.history.go(-1)">后退 </span> <br />
<span onclick="">前进 </span> <br />
<hr />
<a href="default.aspx" target="_parent">文件(F) </a> <br />
<a href="www.sina.com" target="_parent">编辑(E) </a> <br />
<hr />
</div>
</form>
</body>
</html> 这是JS文件
// JScript 文件
function showmenu()
{
document.getElementById("vv").style.visibility="visible";
var x=document.body.clientWidth-event.clientX;
var y=document.body.clientHeight-event.clientY;
if(x <document.getElementById("vv").offsetWidth)
{
document.getElementById("vv").style.left=event.clientX-document.getElementById("vv").offsetWidth+document.body.scrollLeft;
}
else
{
document.getElementById("vv").style.left=event.clientX+document.body.scrollLeft;
}
if(y <document.getElementById("vv").offsetHeight)
{
document.getElementById("vv").style.top=event.clientY-document.getElementById("vv").offsetHeight+document.body.scrollTop;
}
else
{
document.getElementById("vv").style.top=event.clientY+document.body.scrollTop;
} }
function hiddmenu()
{
document.getElementById("vv").style.visibility= "hidden";
}
这是CS页面的:
public partial class Default3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("hello world");
}
}
问题出现了..如果我不输出hello world 这个脚本就不好用..
输出就不没问题...郁闷...
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页 </title>
<script type="text/javascript" src="JScript.js"> </script>
</head>
<body oncontextmenu="showmenu(); return false;" onclick="hiddmenu();">
<form id="form1" runat="server">
<div id="vv" style=" position:absolute; visibility:hidden; border-right: 2px outset; border-top: 2px outset; font-weight: lighter;
font-size: 9pt; border-left: 2px outset; border-bottom: 2px outset;
width:100px; height:100px; background-color: menu">
<span onclick="window.history.go(-1)">后退 </span> <br />
<span onclick="">前进 </span> <br />
<hr />
<a href="default.aspx" target="_parent">文件(F) </a> <br />
<a href="www.sina.com" target="_parent">编辑(E) </a> <br />
<hr />
</div>
</form>
</body>
</html> 这是JS文件
// JScript 文件
function showmenu()
{
document.getElementById("vv").style.visibility="visible";
var x=document.body.clientWidth-event.clientX;
var y=document.body.clientHeight-event.clientY;
if(x <document.getElementById("vv").offsetWidth)
{
document.getElementById("vv").style.left=event.clientX-document.getElementById("vv").offsetWidth+document.body.scrollLeft;
}
else
{
document.getElementById("vv").style.left=event.clientX+document.body.scrollLeft;
}
if(y <document.getElementById("vv").offsetHeight)
{
document.getElementById("vv").style.top=event.clientY-document.getElementById("vv").offsetHeight+document.body.scrollTop;
}
else
{
document.getElementById("vv").style.top=event.clientY+document.body.scrollTop;
} }
function hiddmenu()
{
document.getElementById("vv").style.visibility= "hidden";
}
这是CS页面的:
public partial class Default3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("hello world");
}
}
问题出现了..如果我不输出hello world 这个脚本就不好用..
输出就不没问题...郁闷...
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货