用不到php的...
用js就可以了....
<STYLE type=text/css>#floater
{
LEFT: 660px; POSITION: absolute; TOP: 0px; VISIBILITY: visible; WIDTH: 120px; Z-INDEX: 1
}
</STYLE>
<SCRIPT language=JavaScript>
<!--function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</SCRIPT>
<DIV align=center id=floater 
style="HEIGHT: 226px; LEFT: 640px; TOP: 150px; WIDTH: 131px"> 
  <TABLE width=130 border=0 cellPadding=0 cellSpacing=0 class="font12">
    <TR> 
      <TD width="130" height="24" bgcolor="#BAD2FA"><div align="center">可以拖动</div></TD>
    </TR>
    <TR>
      <TD height="1" bgcolor="#000033"></TD>
    </TR>
    <TR> 
      <TD height="200"><a href="000.php" target="_blank"><img src="adv.gif" width="130" height="200" border="0"></a></TD>
    </TR>
  </TABLE>
</DIV>
</SCRIPT>
太长了....
贴不动了......
我想你看也看不动了

解决方案 »

  1.   

    <html><style>
      DIV {cursor: hand}
    </style><body style="font-family: verdana">
    <H2>Simple Drag and Resize Example</h2>
    <h4>Use alt-click to multi-select</h4><input type=button value="Moving, click to resize"
      onclick="toggleMoveResize(this); return false"><div moveable=true style="position: absolute;
                       top: 150px; left: 100px;
                       width: 100px; height: 100px;
                       background-color: red;
                         border: solid 2px black">
    Click and drag me
    </div><div moveable=true style="position: absolute;
                       top: 150px; left: 250px;
                       width: 100px; height: 100px;
                       background-color: blue;
                         border: solid 2px black">
    Click and drag me
    </div><script language="JavaScript">
    var activeElements = new Array();
    var activeElementCount = 0;var lTop, lLeft;
    var doMove = true;
    var doResize = false;function toggleMoveResize(e) {
      if (doMove) {
        doMove = false;
        doResize = true;
        e.value = "Resizing, Click to Move";
      } else {
        doMove = true;
        doResize = false;
        e.value = "Moving, Click to Resize";
      }
    }function mousedown() {
      var mp;  mp = findMoveable(window.event.srcElement);  if (!window.event.altKey) {
         for (i=0; i<activeElementCount; i++) {
            if (activeElements[i] != mp) {
              activeElements[i].style.borderWidth = "2px";
            }
         }
         if (mp) {
           activeElements[0] = mp;
           activeElementCount = 1;
           mp.style.borderWidth = "4px";
         } else {
           activeElementCount = 0;
         }
      } else {
         if (mp) {
           if (mp.style.borderWidth != "4px") {
             activeElements[activeElementCount] = mp;
             activeElementCount++;
             mp.style.borderWidth = "4px";
           }
         }
      }  window.status = activeElementCount;  lLeft = window.event.x;
      lTop = window.event.y;
    }document.onmousedown = mousedown;function mousemove() {
      var i, dLeft, dTop;  if (window.event.button == 1) {    sx = window.event.x;
        sy = window.event.y;    dLeft = sx - lLeft;
        dTop = sy - lTop;    for (i=0; i<activeElementCount; i++) {
          if (doMove)
            moveElement(activeElements[i], dLeft, dTop);
          if (doResize)
            resizeElement(activeElements[i], dLeft, dTop);
        }    lLeft = sx;
        lTop = sy;    return false;
      }}function moveElement(mp, dLeft, dTop) {
        var e
        e = mp;
        e.style.posTop += dTop;
        e.style.posLeft += dLeft;
    }function resizeElement(mp, dLeft, dTop) {
        var e;
        e = mp;
        e.style.posHeight += dTop;
        e.style.posWidth += dLeft;
    }function findMoveable(e) {
      if (e.moveable == 'true')
        return e;  if (e.tagName == "BODY")
        return null;  return findMoveable(e.parentElement);
    }function findDefinedMoveable(e) {
      if ((e.moveable == 'true') || (e.moveable == 'false'))
        return e;  if (e.tagName == "BODY")
        return null;  return findDefinedMoveable(e.parentElement);
    }function rfalse() {
      return false;
    }document.onmousemove = mousemove;
    document.onselectstart = rfalse;</script></body></html>