<!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>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<style>
*{margin:0px;padding:0px}
</style>
</head>
<body>
<div id="my" style="width:200px;height:150px;background:#f1fada;">
<div id="top" style="background:#f4f4f4;cursor:move">tip</div>
<div id="bv">
this is a test
</div>
</div>
<script>
function $(o){
return document.getElementById(o);
}
$("top").onmousedown=function(event){
var x1=event.clientX-$("my").offsetLeft;
var y1=event.clientY-$("my").offsetTop;
var witchButton=false;
if(document.all&&event.button==1){witchButton=true;}
else{if(event.button==0)witchButton=true;}
if(witchButton)
{
$("top").onmousemove=function(event){
$("my").style.position="absolute";
$("my").style.left=event.clientX-x1+"px";
$("my").style.top=event.clientY-y1+"px";
}
$("top").onmouseup=function(){
$("top").onmousemove=null;
}
}
}
</script>
</body>
</html>
コードは、あなたのexplororでそれを試すことができ、カーソルの表示方法を移動するときは?
権利です。
私は(テキスト型)カーソル表示が「I」で、私が移動するときにお願いしたいと思います、私は修正するために行うことができますどのように、
を移動していませんか?
Strange..Its:http://jsfiddle.net/qR7d9/ – Unknown
は私の答えを削除し、私は読んで申し訳ありませんあなたの質問が早すぎて、jQueryで作業していると思って、コード内の最初の関数を完全に見逃しました:) –