<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<title> 新建网页 1 </title>
<script>
var x=0;
var y=0;
var top;
var left;
function mousedown()
{
x=event.x;
y=event.y;
}
function mouseup()
{
top=document.all.div1.style.top;
left=document.all.div1.style.left;
document.all.div1.style.top=parseInt(top.substring(0,top.length-2))+(event.y-y);
document.all.div1.style.left=parseInt(left.substring(0,left.length-2))+(event.x-x);
y=event.y;
x=event.x;
}
</script>
</head>
<body onmousemove= "mousemove()">
<div id=div1 style= "position:absolute;top:100px;left:100px;width:100px;height:100px;background-color:#cccccc;cursor:hand" onmousedown= " mousedown()" onmouseup= "mouseup() ">
<img src="D:/项目/4.工程报废/S95标准测井曲线图(2).EMF">
</div>
</body>
</html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<title> 新建网页 1 </title>
<script>
var x=0;
var y=0;
var top;
var left;
function mousedown()
{
x=event.x;
y=event.y;
}
function mouseup()
{
top=document.all.div1.style.top;
left=document.all.div1.style.left;
document.all.div1.style.top=parseInt(top.substring(0,top.length-2))+(event.y-y);
document.all.div1.style.left=parseInt(left.substring(0,left.length-2))+(event.x-x);
y=event.y;
x=event.x;
}
</script>
</head>
<body onmousemove= "mousemove()">
<div id=div1 style= "position:absolute;top:100px;left:100px;width:100px;height:100px;background-color:#cccccc;cursor:hand" onmousedown= " mousedown()" onmouseup= "mouseup() ">
<img src="D:/项目/4.工程报废/S95标准测井曲线图(2).EMF">
</div>
</body>
</html>
解决方案 »
- 求教jPlayer
- 困惑不解的javascript腳本錯誤
- 动态创建一个chekbox 的onclick却在创建是自动执行.????
- 为什么页面中的图片显示总是一个白块
- Treeview怎么实现全选
- 用户访问我的站点时,如何获取浏览器的历史记录,需要每个记录的完整的URL
- [问题] 利用Javascript连接至新窗口
- 如何让一个列表框的选定的值,添加到另一个列表框中
- 关于跨越框架的动态菜单
- 急!!javascript中有没有判断输入是否为数字的方法???
- 求一正则表示式验证方法(javascript)急!线上等!
- 下面代码中substring 为啥是返回(lens-4,lens) 谁能告诉我 谢谢
<body onmousemove= "mousemove()">
这里的mousemove是调用js中自身的方法,就是执行mousemove方法
<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<title> 新建网页 1 </title>
<script>
var x=0;
var y=0;
var top;
var left;
var flag = false;
function mousedown(){
x=event.x;
y=event.y;
flag = true;
}
function mouseup(){
flag = false;
}
function mousemove(){
if(!flag) return;
top=document.all.div1.style.top;
left=document.all.div1.style.left;
document.all.div1.style.top=parseInt(top.substring(0,top.length-2))+(event.y-y);
document.all.div1.style.left=parseInt(left.substring(0,left.length-2))+(event.x-x);
y=event.y;
x=event.x;
}
</script>
</head>
<body>
<div id=div1 style= "position:absolute;top:100px;left:100px;width:100px;height:100px;background-color:#cccccc;cursor:hand" onmousedown= "mousedown()" onmouseup="mouseup()" onmousemove= "mousemove() ">
<img src="D:/项目/4.工程报废/S95标准测井曲线图(2).EMF">
</div>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
var curLeft = 0;
var curTop = 0;
var curX = 0;
var curY = 0;
var bool = false;
function show() {
curLeft = document.getElementById("div1").style.pixelLeft;
curTop = document.getElementById("div1").style.pixelTop;
curX = event.clientX;
curY = event.clientY;
document.onmouseover = showDown;
bool = true;
} var curClientX = 0;
var curClientY = 0;
function showDown() {
if (bool) {
curClientX = event.clientX;
curClientY = event.clientY;
document.getElementById("div1").style.pixelLeft = curLeft + (curClientX - curX);
document.getElementById("div1").style.pixelTop = curTop + (curClientY - curY);
}
}//-->
</SCRIPT>
</HEAD><BODY>
<div id="div1" style= "position:absolute;top:100px;left:100px;width:100px;height:100px;background-color:#cccccc;cursor:hand;z-index:1;" onmousedown="show() " onmouseup= "bool = false">
</div> </BODY>
</HTML>