ASP.NET如何用鼠标拖出虚线框,释放鼠标虚框消失,就和在windows桌面上拖动鼠标一样
我现在在JS里面实现鼠标拖动取两点坐标,也实现了虚线拖动,但就是两个JS我一合到一起,全部都不好使了!各位大人能不能给合到一起?非常感谢
取两点坐标代码::
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default5.aspx.cs" Inherits="Default5" %>
<!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 id="Head1" runat="server">
<title>无标题页</title>
<link href="css/css1.css" type="text/css" rel="stylesheet"/>
<script language="javascript" type="text/javascript">
function fun()
{
var x= event.x;
var y=event.y;
document.getElementById("TextBox7").value=x+","+y;
}
function fun1()
{
var x= event.x;
var y=event.y;
document.getElementById("TextBox6").value=x+","+y;
}
function DrawImage(ImgD,FitWidth,FitHeight)
{
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0)
{
if(image.width/image.height>= FitWidth/FitHeight)
{
if(image.width>FitWidth){
ImgD.width=FitWidth;
ImgD.height=(image.height*FitWidth)/image.width;
}
else
{
ImgD.width=image.width;
ImgD.height=image.height;
}
}
else
{
if(image.height>FitHeight)
{
ImgD.height=FitHeight;
ImgD.width=(image.width*FitHeight)/image.height;
}
else
{
ImgD.width=image.width;
ImgD.height=image.height;
}
}
}
}
</script>
</head>
<body>
<form id="form1" runat="server" >
<div >
<div style="position:absolute;left:100px; top:300px; z-index:1; width:800px; height:800px;" ></div>
<div style="width:800px; height:800px;z-index:-100;position:absolute; left:100px; top:300px;">
<img src="image/2008.jpg" alt="2008.jpg" style="z-index:-100; display:inline;" onload="javascript:DrawImage(this,800,800);" onmouseup="fun()" onmousedown="fun1()" onmousemove="Imageonmousemove()"/></div>
<table style="width: 696px; text-align: center">
<tr>
<td style="width: 83px; text-align: left;">
<asp:Label ID="Label6" runat="server" Text="图片区域:"></asp:Label></td>
<td style="width: 100px; text-align: left;">
<asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True" Width="156px">
</asp:DropDownList></td>
<td style="width: 100px; text-align: left">
<asp:Label ID="Label3" runat="server" Text="图片类别:"></asp:Label></td>
<td style="width: 100px; text-align: left">
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" Width="153px" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
<asp:ListItem Value="0">长方形</asp:ListItem>
<asp:ListItem Value="1">多边形</asp:ListItem>
<asp:ListItem Value="2">圆形</asp:ListItem>
</asp:DropDownList></td>
</tr>
<tr>
<td style="width: 83px; text-align: left;">
<asp:Label ID="Label7" runat="server" Text="图片名称:"></asp:Label></td>
<td style="width: 100px; text-align: left;">
<asp:TextBox ID="TextBox2" runat="server" AutoPostBack="True"></asp:TextBox></td>
<td style="width: 100px; text-align: left">
<asp:Label ID="Label10" runat="server" Text="图片链接:"></asp:Label></td>
<td style="width: 100px; text-align: left">
<asp:TextBox ID="TextBox5" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td style="width: 83px; text-align: left">
<asp:Label ID="Label9" runat="server" Text="图片宽度:"></asp:Label></td>
<td style="width: 100px; text-align: left">
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox></td>
<td style="width: 100px; text-align: left">
<asp:Label ID="Label11" runat="server" Text="开始坐标:"></asp:Label></td>
<td style="width: 100px; text-align: left">
<asp:TextBox ID="TextBox6" runat="server"></asp:TextBox>
<asp:Label ID="Label1" runat="server"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server" Width="65px" Visible="False"></asp:TextBox></td>
</tr>
<tr>
<td style="width: 83px; text-align: left; height: 26px;">
<asp:Label ID="Label8" runat="server" Text="图片高度:"></asp:Label></td>
<td style="width: 100px; text-align: left; height: 26px;">
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox></td>
<td style="width: 100px; height: 26px; text-align: left">
<asp:Label ID="Label2" runat="server" Text="结束坐标:"></asp:Label></td>
<td style="width: 100px; height: 26px; text-align: left">
<asp:TextBox ID="TextBox7" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td colspan="4" style="height: 39px; text-align: center">
<asp:ImageButton ID="ImageButton1" runat="server" Height="29px" ImageUrl="~/image/save1.gif"
Width="109px" OnClick="ImageButton1_Click" />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="获取坐标" /></td>
</tr>
</table>
</div>
</form>
</body>
</html>