急需php移动代码,求高手指点 许愿墙上的贴纸鼠标按下能移动 代码怎么写? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 又来问?Jquery 里又现成的插件。又或者 js 移动 div.不要在这里找现成能符合你答案的代码。google上又许多,如果那些你看不懂 那么贴给你也是白贴。不懂就从基础学起,要不然永远都不会,永远都要求代码。<html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>移动Div层</title></head><body onmousemove="window.status = 'X='+event.x+'Y='+event.y"> <form id="form1" runat="server"> <div> <div id="panl" style='position: absolute; left: 0px; top:0px ; background-color:Blue; width:900px ; height:600px ;'> </div> <input id="Button1" style="position:absolute; left: 0px; top:300px ; width:50px ; height:40px; " type="button" value="添加" onclick="addDiv()" /> <input id="Button2" style="position:absolute; left:50px; top:300px; width:50px; height:40px;" type="button" value="显示" onclick="saveDiv()"> </div> <script language="javascript" type="text/javascript"> // Arnold Elric Date:07-10-10 var myArray=new Array; //全局变量var Obj='';var px=0;var py=0;var i=1;function addDiv() //添加Div{var Name="Name"+i;var x=Math.floor(Math.random()*(900-70));var y=Math.floor(Math.random()*(600-70));var arr=new Array();arr[0]=Name;arr[1]=x;arr[2]=y;myArray[myArray.length]=arr;var str='';str+="<div id="+Name+" style='position: absolute; left:"+x+"px; top:"+y+"px; background-color:Red; width:70px; height:70px; ' onmousedown=MD(this) onmousemove=MM() onmouseup=MU() ><input id='img"+Name+" ' style=' width:30px; height:25px; 'type='button' value='关闭' onclick=closeDiv("+Name+") ></div></div>";var Div=document.getElementById("panl");Div.insertAdjacentHTML('beforeEnd',str);i++;}function saveDiv() //显示Div { var str=''; for(var i=0;i<myArray.length;i++) { str+="id: "+myArray[i][0]+" left:"+myArray[i][1]+"px"+" top:"+myArray[i][2]+"px"+"\n"; } alert(str);}function closeDiv(DivID) //关闭Div{ deleteDate(DivID); var div=document.getElementById("panl"); div.removeChild(DivID);}function MD(object) //鼠标放下{ Obj=object.id; document.all(Obj).setCapture(); px=event.x-document.all(Obj).style.pixelLeft; // 计算鼠标偏移 py=event.y-document.all(Obj).style.pixelTop; }function MM() //鼠标移动{ if(Obj!='') { document.all(Obj).style.left=event.x-px; document.all(Obj).style.top=event.y-py; }}function MU() //鼠标抬起{ if(Obj!='') { document.all(Obj).releaseCapture(); changeDate(); Obj=''; }}function changeDate() //移动Div后 改变数组中的值{ for(var i=0;i<myArray.length;i++) { if(Obj==myArray[i][0]) { myArray[i][1]=event.x-px; myArray[i][2]=event.y-py; } }}function deleteDate(DivID)//删除存在数组中的那条Div 纪录{ for(var i=0;i<myArray.length;i++) { if(DivID.id==myArray[i][0]) { myArray.splice(i,1); } }}</script> </form></body></html> jquery问题 运行源码,出现 ZEND ,这是为什么? PHP网页中文乱码问题 怎么实现像DZ那样不登陆就无法查看某个帖子 如何在IE当中显示链接,求救!!! 苦恼! 帮人做的第一个php站,看看行吗? 在 pws 下我能用php_gd.dll中的圖像函數,但在 apache 下不能用,我還要注意那些設置??? 高分请教!!!懂JS、PHP的朋友请进!!!! mysql两张表的关联查询 求好心人士帮忙改改代码 关于将文本框修改后的值存入数据库。
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>移动Div层</title></head>
<body onmousemove="window.status = 'X='+event.x+'Y='+event.y">
<form id="form1" runat="server">
<div>
<div id="panl" style='position: absolute; left: 0px; top:0px ; background-color:Blue; width:900px ; height:600px ;'>
</div>
<input id="Button1" style="position:absolute; left: 0px; top:300px ; width:50px ; height:40px; " type="button" value="添加" onclick="addDiv()" />
<input id="Button2" style="position:absolute; left:50px; top:300px; width:50px; height:40px;" type="button" value="显示" onclick="saveDiv()">
</div>
<script language="javascript" type="text/javascript">
// Arnold Elric Date:07-10-10
var myArray=new Array; //全局变量
var Obj='';
var px=0;
var py=0;
var i=1;
function addDiv() //添加Div
{var Name="Name"+i;
var x=Math.floor(Math.random()*(900-70));
var y=Math.floor(Math.random()*(600-70));
var arr=new Array();
arr[0]=Name;
arr[1]=x;
arr[2]=y;
myArray[myArray.length]=arr;var str='';
str+="<div id="+Name+" style='position: absolute; left:"+x+"px; top:"+y+"px; background-color:Red; width:70px; height:70px; ' onmousedown=MD(this) onmousemove=MM() onmouseup=MU() ><input id='img"+Name+" ' style=' width:30px; height:25px; 'type='button' value='关闭' onclick=closeDiv("+Name+") ></div></div>";
var Div=document.getElementById("panl");
Div.insertAdjacentHTML('beforeEnd',str);
i++;
}
function saveDiv() //显示Div
{
var str='';
for(var i=0;i<myArray.length;i++)
{
str+="id: "+myArray[i][0]+" left:"+myArray[i][1]+"px"+" top:"+myArray[i][2]+"px"+"\n";
}
alert(str);
}
function closeDiv(DivID) //关闭Div
{
deleteDate(DivID);
var div=document.getElementById("panl");
div.removeChild(DivID);
}
function MD(object) //鼠标放下
{
Obj=object.id;
document.all(Obj).setCapture();
px=event.x-document.all(Obj).style.pixelLeft; // 计算鼠标偏移
py=event.y-document.all(Obj).style.pixelTop;
}
function MM() //鼠标移动
{
if(Obj!='')
{
document.all(Obj).style.left=event.x-px;
document.all(Obj).style.top=event.y-py;
}
}
function MU() //鼠标抬起
{
if(Obj!='')
{
document.all(Obj).releaseCapture();
changeDate();
Obj='';
}
}
function changeDate() //移动Div后 改变数组中的值
{
for(var i=0;i<myArray.length;i++)
{
if(Obj==myArray[i][0])
{
myArray[i][1]=event.x-px;
myArray[i][2]=event.y-py;
}
}
}function deleteDate(DivID)//删除存在数组中的那条Div 纪录
{
for(var i=0;i<myArray.length;i++)
{
if(DivID.id==myArray[i][0])
{
myArray.splice(i,1);
}
}}</script>
</form>
</body>
</html>