2010年4月19日 星期一

抓畫面上滑鼠點下的座標,並show出元件

<!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">
function Hide(flag){
if (flag == 1)
document.getElementById("div1").style.display = "";
document.getElementById("div1").style.left = event.clientX;
document.getElementById("div1").style.top = document.body.scrollTop + event.clientY;
if (flag == 0)
document.getElementById("div1").style.display="none";
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>

<div id="div1" style ="display:none;border: 1px solid #A1A31B; position:absolute; height:40px; width:40px; background-color:#FFFFEB; ">
測試
</div>
<input id="Button1" type="button" value="pop.................................................." onclick="Hide(1);"/>
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
</html>

沒有留言:

張貼留言