大家帮我看看这个JS 谁帮忙改写一下 我是新手
大家帮我看看这个JS 谁帮忙改写一下
在拖动的时候鼠标移过去他就动了 点链接都点不到 是怎么回事 不能准确获得坐标?
请大侠帮忙看看 改写一下 最好把挂件部分能改成支持多个的!附上代码!
一下是提交部分的代码 :
ShowWebA=ShowWebA&"<div id=""musicPlayer"" class=""dragdiv"" onmouseout=""this.style.backgroundColor=''"" onmouseover=""this.style.backgroundColor='#ACA100'"" style=""position:absolute;width:200px;height:100px;z-index:200;left:"&WebAl&"px;top:"&WebAt&"px;""oncontextmenu=""showmenuie5('','',4);""onclick=""hidemenuie5();""onmousedown=""kk(this);getFocus(this);""onmouseup=""stopDrag(this)""onmousemove=""drag(this)""onSelectStart=""returnfalse"">"
ShowWebA=ShowWebA&"<table class=""module""width=""100%""cellpadding=""0""cellspacing=""0""border=""0"">"
ShowWebA=ShowWebA&"<tr>"
ShowWebA=ShowWebA&"<td class=""header"">"
ShowWebA=ShowWebA&"<div class=""title""><strong>播放器</strong> <a onClick=""Japay();"" style=""cursor:hand""><strong><font color=""#ffffff"">保存设置</font></strong></a></div>"
ShowWebA=ShowWebA&"</td>"
ShowWebA=ShowWebA&"</tr>"
ShowWebA=ShowWebA&"<tr>"
ShowWebA=ShowWebA&"<td>"
ShowWebA=ShowWebA&"<object classid=""clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"" codebase=""http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"" width=""210"" height=""120"" id=""musicSwf"">"
ShowWebA=ShowWebA&"<param name=""movie"" value="""&WebA&""">"
ShowWebA=ShowWebA&"<param name=""quality"" value=""high"">"
ShowWebA=ShowWebA&"<param name=""wmode"" value=""transparent"">"
ShowWebA=ShowWebA&"<param name=""allowScriptAccess"" value=""always"">"
ShowWebA=ShowWebA&"</object>"
ShowWebA=ShowWebA&"</td></tr>"
ShowWebA=ShowWebA&"</table>"
ShowWebA=ShowWebA&"</div>"
下面是JS
function showmenuie5(a,c,g)
{
document.oncontextmenu = function() {return false;}
var rightedge = document.body.clientWidth - event.clientX;
if(g==1)
{
kao.style.left=a;
kao.style.top=c;
}
if(g==2)
{
kao.style.left='2';
}
if(g==3)
{
kao.style.left='3';
}
if(g==4)
{
kao.style.left='4';
}
ie5menu.style.visibility = "visible";
if (rightedge < ie5menu.offsetWidth)
ie5menu.style.left = document.body.scrollLeft + event.clientX -ie5menu.offsetWidth;
else
ie5menu.style.left = document.body.scrollLeft + event.clientX;
if (event.clientY < ie5menu.offsetHeight)
ie5menu.style.top = document.body.scrollTop + event.clientY;
else
ie5menu.style.top = document.body.scrollTop + event.clientY - ie5menu.offsetHeight;
return false;
}
function hidemenuie5() {
ie5menu.style.visibility = "hidden";
document.oncontextmenu = function() {return false;}
}
var x0=0,y0=0,x1=0,y1=0;
var offx=10,offy=10;
var moveable=false;
var index = 1000;
var indexa = 0;
function kk(obj)
{
//记录鼠标和层位置;
indexa=obj.style.zIndex
var x0 = event.clientX;
var y0 = event.clientY;
var x1 = parseInt(obj.style.left);
var y1 = parseInt(obj.style.top);
obj.style.cursor="move";
moveable = true;
}
function drag(obj)
{
if(moveable)
{
document.oncontextmenu = function() {return false;}
obj.style.left = event.clientX-40 + body.scrollLeft;
obj.style.top = event.clientY-50 + body.scrollTop;
}
}
function stopDrag(obj)
{
if(moveable)
{
var win = obj.parentNode;
obj.releaseCapture();
moveable = false;
}
}
function getFocus(obj)
{
if(obj.style.zIndex!=index)
{
index = index + 1000;
var idx = index;
obj.style.zIndex=idx;
}
}
function Japay()
{
var jxy = "";
var bxy ="";
//挂件可移动组装数组
try
{
for(var i=0;i<divc+1;i++)
{
if(top.s[i].src.indexOf("b.gif")<0)
{
var sp = "none";
}
}
}
catch(e)
{
//flyt=getCookie("buy");
//alert(flyt);
}
//音乐层组装
ml = top.musicPlayer.style.left.replace("px","");
mt = top.musicPlayer.style.top.replace("px","");
ul = top.userg.style.left.replace("px","");
ut = top.userg.style.top.replace("px","");
var allxy = ml + "$" + mt + "$" + ul + "$" + ut;
var urls = "WebSave.asp?l=web&n=" +allxy;
window.showModalDialog(urls, null, "dialogWidth=290px; dialogHeight:120px; help:no; status:no");
}
window.onerror = function()
{
return true;
}