我现在做了一个用户控件,里面放了一个<IMG>,写了一些javascript代码,在执行时,说缺少对象!!
<%@ Control Language="c#" AutoEventWireup="false" Codebehind="WebUserControl1.ascx.cs" Inherits="WebGis.WebUserControl1" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<P><FONT face="宋体">
</P>
<div id="BViewRect" style="BORDER-RIGHT:2px solid; BORDER-TOP:2px solid; FONT-SIZE:1px; BORDER-LEFT:2px solid; WIDTH:146px; COLOR:#0099ff; BORDER-BOTTOM:2px solid; HEIGHT:107px"
onmousedown="return BViewRect_OnDrag()">
<IMG id="BirdViewer" alt="" src="PIC/eMapBird.gif" width="146" height="107" border="0"
style="CURSOR: crosshair" language="javascript" onMouseUp="BirdViewer_onmouseup()"
onMouseMove="BirdViewer_onmousemove()" onMouseDown="BirdViewer_onmousedown()">
</div>
</FONT>
<script language="javascript" id="clientEventHandlersJS">
<!--
var x0,y0;
var isDraw = false;
var isRectDraged = false;
var RectDragedX = 0;
var RectDragedY = 0;
x0 = 0;
y0 = 0;
function BirdViewer_onmousedown()
{
isDraw = true;
x0 = event.x;
y0 = event.y;
}
function BirdViewer_onmousemove()
{
var x = event.x;
var y = event y;
var x1,x2,y1,y2;
x1 = 0;
y1 = 0;
x2 = 0;
y2 = 0;
//InfoShow.innerText = x + "," + y;
//window.status = x + "," + y;
//框被拉动
if (isRectDraged)
{
var tmpx;
var tmpy;
tmpx = BViewRect.style.left;
tmpy = BViewRect.style.top;
tmpx.replace ("px", "");
tmpy.replace ("px", "");
BViewRect.style.left = parseFloat (tmpx) - RectDragedX + x;
BViewRect.style.top = parseFloat (tmpy) - RectDragedY + y;
RectDragedX = x;
RectDragedY = y;
BirdViewer_onmouseup();
}
else
{
if (isDraw)
{
if (x0 < x)
{
x1 = x0;
x2 = x;
}
else
{
x1 = x;
x2 = x0;
}
if (y0 < y)
{
y1 = y0;
y2 = y;
}
else
{
y1 = y;
y2 = y0;
}
BViewRect.style.left = x1;
BViewRect.style.top = y1;
BViewRect.style.width = x2 - x1;
BViewRect.style.height = y2 - y1;
//BViewRect.style.visibility = "visible";
if (event.button == 0)
{
//alert("ok");
BirdViewer_onmouseup();
return;
}
}
}
}
function BViewRect_OnDrag()
{
RectDragedX = event.x;
RectDragedY = event.y;
if (isRectDraged == false)
{
BirdViewer.style.cursor = "move";
isRectDraged = true;
}
else
{
BirdViewer.style.cursor = "crosshair";
isRectDraged = false;
}
}
//Range=-60227.4921875 ,-59943.18359375 45396.02734375 , 33425.58984375
function BirdViewer_onmouseup()
{
isDraw = false;
var ss;
var x1, y1, x2, y2;
var l = 0;
var t = 0;
var w = 0;
var h = 0;
ss = BViewRect.style.left;
ss.replace ("px", "");
l = parseFloat (ss);
ss = BViewRect.style.top;
ss.replace ("px", "");
t = parseFloat (ss);
ss = BViewRect.style.width;
ss.replace ("px", "");
w = parseFloat (ss); ss = BViewRect.style.height;
ss.replace ("px", "");
h = parseFloat (ss);
//alert(l + "," + t + "," + w + "," + h);
//(x1,y2) 左上角坐标
x1 = -60227 + l * 723;
y2 = 33426 - t * 873;
//右下脚坐标
x2 = x1 + w * 723;
y1 = y2 - h * 873;
window.parent.eZoomToWin (x1, y2, x2, y1);
//alert(x1 + "," + y1 + "," + x2 + "," + y2);
}
function ZoomToWin(x1, y1, x2, y2)
{
var t, l, w, h;
//alert(x1 + "," + y1 + "," + x2 + "," + y2);
l = (x1 + 60227) / 723;
t = (33426 - y2) / 873;
//alert(t);
w = (x2 - x1) / 723;
h = (y2 - y1) / 873;
if (l > 146) l = 146;
if (t > 107) t = 107;
if ((l + w) > 146) w = 146 - l;
if ((t + h) > 107) h = 107 - t; if (l < 0) {
w += l;
l = 0;
}
if (t < 0) {
h += t;
t = 0;
}
if (w < 1) w = 1;
if (h < 1) h = 1;
//alert(t);
//alert(l + "," + t + "," + w + "," + h);
BViewRect.style.left = l;
BViewRect.style.top = t;
BViewRect.style.width = w;
BViewRect.style.height = h;
//BViewRect.style.visibility = "visible";
}-->
</script>
大家帮我看看,那里出了问题!!
<%@ Control Language="c#" AutoEventWireup="false" Codebehind="WebUserControl1.ascx.cs" Inherits="WebGis.WebUserControl1" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<P><FONT face="宋体">
</P>
<div id="BViewRect" style="BORDER-RIGHT:2px solid; BORDER-TOP:2px solid; FONT-SIZE:1px; BORDER-LEFT:2px solid; WIDTH:146px; COLOR:#0099ff; BORDER-BOTTOM:2px solid; HEIGHT:107px"
onmousedown="return BViewRect_OnDrag()">
<IMG id="BirdViewer" alt="" src="PIC/eMapBird.gif" width="146" height="107" border="0"
style="CURSOR: crosshair" language="javascript" onMouseUp="BirdViewer_onmouseup()"
onMouseMove="BirdViewer_onmousemove()" onMouseDown="BirdViewer_onmousedown()">
</div>
</FONT>
<script language="javascript" id="clientEventHandlersJS">
<!--
var x0,y0;
var isDraw = false;
var isRectDraged = false;
var RectDragedX = 0;
var RectDragedY = 0;
x0 = 0;
y0 = 0;
function BirdViewer_onmousedown()
{
isDraw = true;
x0 = event.x;
y0 = event.y;
}
function BirdViewer_onmousemove()
{
var x = event.x;
var y = event y;
var x1,x2,y1,y2;
x1 = 0;
y1 = 0;
x2 = 0;
y2 = 0;
//InfoShow.innerText = x + "," + y;
//window.status = x + "," + y;
//框被拉动
if (isRectDraged)
{
var tmpx;
var tmpy;
tmpx = BViewRect.style.left;
tmpy = BViewRect.style.top;
tmpx.replace ("px", "");
tmpy.replace ("px", "");
BViewRect.style.left = parseFloat (tmpx) - RectDragedX + x;
BViewRect.style.top = parseFloat (tmpy) - RectDragedY + y;
RectDragedX = x;
RectDragedY = y;
BirdViewer_onmouseup();
}
else
{
if (isDraw)
{
if (x0 < x)
{
x1 = x0;
x2 = x;
}
else
{
x1 = x;
x2 = x0;
}
if (y0 < y)
{
y1 = y0;
y2 = y;
}
else
{
y1 = y;
y2 = y0;
}
BViewRect.style.left = x1;
BViewRect.style.top = y1;
BViewRect.style.width = x2 - x1;
BViewRect.style.height = y2 - y1;
//BViewRect.style.visibility = "visible";
if (event.button == 0)
{
//alert("ok");
BirdViewer_onmouseup();
return;
}
}
}
}
function BViewRect_OnDrag()
{
RectDragedX = event.x;
RectDragedY = event.y;
if (isRectDraged == false)
{
BirdViewer.style.cursor = "move";
isRectDraged = true;
}
else
{
BirdViewer.style.cursor = "crosshair";
isRectDraged = false;
}
}
//Range=-60227.4921875 ,-59943.18359375 45396.02734375 , 33425.58984375
function BirdViewer_onmouseup()
{
isDraw = false;
var ss;
var x1, y1, x2, y2;
var l = 0;
var t = 0;
var w = 0;
var h = 0;
ss = BViewRect.style.left;
ss.replace ("px", "");
l = parseFloat (ss);
ss = BViewRect.style.top;
ss.replace ("px", "");
t = parseFloat (ss);
ss = BViewRect.style.width;
ss.replace ("px", "");
w = parseFloat (ss); ss = BViewRect.style.height;
ss.replace ("px", "");
h = parseFloat (ss);
//alert(l + "," + t + "," + w + "," + h);
//(x1,y2) 左上角坐标
x1 = -60227 + l * 723;
y2 = 33426 - t * 873;
//右下脚坐标
x2 = x1 + w * 723;
y1 = y2 - h * 873;
window.parent.eZoomToWin (x1, y2, x2, y1);
//alert(x1 + "," + y1 + "," + x2 + "," + y2);
}
function ZoomToWin(x1, y1, x2, y2)
{
var t, l, w, h;
//alert(x1 + "," + y1 + "," + x2 + "," + y2);
l = (x1 + 60227) / 723;
t = (33426 - y2) / 873;
//alert(t);
w = (x2 - x1) / 723;
h = (y2 - y1) / 873;
if (l > 146) l = 146;
if (t > 107) t = 107;
if ((l + w) > 146) w = 146 - l;
if ((t + h) > 107) h = 107 - t; if (l < 0) {
w += l;
l = 0;
}
if (t < 0) {
h += t;
t = 0;
}
if (w < 1) w = 1;
if (h < 1) h = 1;
//alert(t);
//alert(l + "," + t + "," + w + "," + h);
BViewRect.style.left = l;
BViewRect.style.top = t;
BViewRect.style.width = w;
BViewRect.style.height = h;
//BViewRect.style.visibility = "visible";
}-->
</script>
大家帮我看看,那里出了问题!!
解决方案 »
- 为什么可以上传.txt文件不可以上传.doc文件
- 请教一个vs2010在win7下调试的问题?
- 大侠帮我看看为什么我的数据不回发
- 我想让用户在站点上输入大段的代码(任何语言格式),然后正确地输出显示,像CSDN一样,应该怎么做?
- sql语句中的where条件中的日期型字段问题比较以及datagrid控件的美化问题
- !!!!!!!!客户端javascript:如何遍历div中的所有CheckBox?急!!!!!!!!!
- 急!Datagrid 绑定的问题,只剩10分了,不够明天加。(在线等)
- To:triout(笨牛)帮帮我了饿
- 今天看见WWW.INTEL.COM网站用的是ASP.NET,大受鼓舞啊!!
- 急,请教在VS里怎么画NS图,并自动生成代码
- 关于ASP.NET2.0 后台代码 写法
- <connectionStrings> 和 <appSettings> 的比较
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form name="Form1" method="post" action="WebForm1.aspx" id="Form1">
<input type="hidden" name="__VIEWSTATE" value="dDwtOTc0MzczNTQ7Oz7x4GgwJXGZiEeNTqu296lj01nCKA==" />
<P><FONT face="宋体">
</P>
<div id="BViewRect" style="BORDER-RIGHT:2px solid; BORDER-TOP:2px solid; FONT-SIZE:1px; BORDER-LEFT:2px solid; WIDTH:146px; COLOR:#0099ff; BORDER-BOTTOM:2px solid; HEIGHT:107px"
onmousedown="return BViewRect_OnDrag()">
<IMG id="BirdViewer" alt="" src="PIC/eMapBird.gif" width="146" height="107" border="0"
style="CURSOR: crosshair" language="javascript" onMouseUp="BirdViewer_onmouseup()"
onMouseMove="BirdViewer_onmousemove()" onMouseDown="BirdViewer_onmousedown()">
</div>
</FONT>
<script language="javascript" id="clientEventHandlersJS"> var x0,y0;
var isDraw = false;
var isRectDraged = false;
var RectDragedX = 0;
var RectDragedY = 0;
x0 = 0;
y0 = 0;
function BirdViewer_onmousedown()
{
isDraw = true;
x0 = event.x;
y0 = event.y;
}
function BirdViewer_onmousemove()
{
var x = event.x;
var y = event y;
var x1,x2,y1,y2;
x1 = 0;
y1 = 0;
x2 = 0;
y2 = 0;
//InfoShow.innerText = x + "," + y;
//window.status = x + "," + y;
//框被拉动
if (isRectDraged)
{
var tmpx;
var tmpy;
tmpx = BViewRect.style.left;
tmpy = BViewRect.style.top;
tmpx.replace ("px", "");
tmpy.replace ("px", "");
BViewRect.style.left = parseFloat (tmpx) - RectDragedX + x;
BViewRect.style.top = parseFloat (tmpy) - RectDragedY + y;
RectDragedX = x;
RectDragedY = y;
BirdViewer_onmouseup();
}
else
{
if (isDraw)
{
if (x0 < x)
{
x1 = x0;
x2 = x;
}
else
{
x1 = x;
x2 = x0;
}
if (y0 < y)
{
y1 = y0;
y2 = y;
}
else
{
y1 = y;
y2 = y0;
}
BViewRect.style.left = x1;
BViewRect.style.top = y1;
BViewRect.style.width = x2 - x1;
BViewRect.style.height = y2 - y1;
//BViewRect.style.visibility = "visible";
if (event.button == 0)
{
//alert("ok");
BirdViewer_onmouseup();
return;
}
}
}
}
function BViewRect_OnDrag()
{
RectDragedX = event.x;
RectDragedY = event.y;
if (isRectDraged == false)
{
BirdViewer.style.cursor = "move";
isRectDraged = true;
}
else
{
BirdViewer.style.cursor = "crosshair";
isRectDraged = false;
}
}
//Range=-60227.4921875 ,-59943.18359375 45396.02734375 , 33425.58984375
function BirdViewer_onmouseup()
{
isDraw = false;
var ss;
var x1, y1, x2, y2;
var l = 0;
var t = 0;
var w = 0;
var h = 0;
ss = BViewRect.style.left;
ss.replace ("px", "");
l = parseFloat (ss);
ss = BViewRect.style.top;
ss.replace ("px", "");
t = parseFloat (ss);
ss = BViewRect.style.width;
ss.replace ("px", "");
w = parseFloat (ss); ss = BViewRect.style.height;
ss.replace ("px", "");
h = parseFloat (ss);
//alert(l + "," + t + "," + w + "," + h);
//(x1,y2) 左上角坐标
x1 = -60227 + l * 723;
y2 = 33426 - t * 873;
//右下脚坐标
x2 = x1 + w * 723;
y1 = y2 - h * 873;
window.parent.eZoomToWin (x1, y2, x2, y1);
//alert(x1 + "," + y1 + "," + x2 + "," + y2);
}
function ZoomToWin(x1, y1, x2, y2)
{
var t, l, w, h;
//alert(x1 + "," + y1 + "," + x2 + "," + y2);
l = (x1 + 60227) / 723;
t = (33426 - y2) / 873;
//alert(t);
w = (x2 - x1) / 723;
h = (y2 - y1) / 873;
if (l > 146) l = 146;
if (t > 107) t = 107;
if ((l + w) > 146) w = 146 - l;
if ((t + h) > 107) h = 107 - t; if (l < 0) {
w += l;
l = 0;
}
if (t < 0) {
h += t;
t = 0;
}
if (w < 1) w = 1;
if (h < 1) h = 1;
//alert(t);
//alert(l + "," + t + "," + w + "," + h);
BViewRect.style.left = l;
BViewRect.style.top = t;
BViewRect.style.width = w;
BViewRect.style.height = h;
//BViewRect.style.visibility = "visible";
}
</script> <P></P>
<P><FONT face="宋体">
<OBJECT id="MapView" style="WIDTH: 100%; HEIGHT: 474px; BACKGROUND-COLOR: #ffffff" codeBase="smiwmap.cab#Version=1,0,0,51"
width="50%" data="data:application/x-oleobject;base64,MYCCyiVD1BG9sgAQWndueAADAACgRwAA/TAAAAsAAAATAAAAAAATAAAAAAALAAAAAwAAAAAA"
classid="clsid:CA828031-4325-11D4-BDB2-00105A776E78 data=data:application/x-oleobject;base64,MYCCyiVD1BG9sgAQWndueAADAAADPgAAWCkAAAsAAAAT"
viewastext>
<embed src="data:application/x-oleobject;base64,MYCCyiVD1BG9sgAQWndueAADAAAEPgAAWCkAAAsAAAATAPv//wATAPv//wALAP//AwD7//8A"
width="100%" height="100%">
</embed>
</OBJECT>
</FONT>
</P> </form>
</body>
</HTML>