Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [JS] Zapamiętywanie położenia
rafaelpl
post
Post #1





Grupa: Zarejestrowani
Postów: 40
Pomógł: 0
Dołączył: 16.01.2008
Skąd: Pszczyna

Ostrzeżenie: (0%)
-----


Witam!

Posiadam następujący skrypt do przeciągania obrazków na stronie.
Czy jest możliwośc zapamiętania położenia wszystkich obrazków w zmiennej(ych) php?
Na JS się nie znam, więc nic tu nie poradzę, a owa funkcja jest mi niezbędna.
Z góry dziękuję za odpowidź.

Kod
  <!-- TWO STEPS TO INSTALL DRAG-N-DROP:
  
    1.  Copy the coding into the HEAD of your HTML document
    2.  Add the last code into the BODY of your HTML document  -->
  
  <!-- STEP ONE: Paste this code into the HEAD of your HTML document  -->
  
  <HEAD>
  
  <script LANGUAGE="JavaScript">
  <!-- Original:  Randy Bennett (rbennett@thezone.net) -->
  <!-- Web Site:  http://home.thezone.net/~rbennett/sitemap.htm -->
  
  <!-- This script and many more are available free online at -->
  <!-- The JavaScript Source!! http://javascript.internet.com -->
  
  <!-- Begin
  N = (document.all) ? 0 : 1;
  var ob;
  function MD(e) {
  if (N) {
  ob = document.layers[e.target.name];
  X=e.x;
  Y=e.y;
  return false;
  }
  else {
  ob = event.srcElement.parentElement.style;
  X=event.offsetX;
  Y=event.offsetY;
     }
  }
  function MM(e) {
  if (ob) {
  if (N) {
  ob.moveTo((e.pageX-X), (e.pageY-Y));
  }
  else {
  ob.pixelLeft = event.clientX-X + document.body.scrollLeft;
  ob.pixelTop = event.clientY-Y + document.body.scrollTop;
  return false;
        }
     }
  }
  function MU() {
  ob = null;
  }
  
  if (N) {
  document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP);
  }
  document.onmousedown = MD;
  document.onmousemove = MM;
  document.onmouseup = MU;
  //  End -->
  </script>
  </HEAD>
  
  <!-- STEP TWO: Copy this code into the BODY of your HTML document  -->
  
  <BODY>
  
  <div id="s" style="position:absolute;left:50;top:300;">
  <img src=http://javascript.internet.com/img/cards/spades.gif name="s">
  </div>
  
  <div id="d" style="position:absolute;left:50;top:350;">
  <img src=http://javascript.internet.com/img/cards/diamonds.gif name="d">
  </div>
  
  <div id="c" style="position:absolute;left:100;top:300;">
  <img src=http://javascript.internet.com/img/cards/clubs.gif name="c">
  </div>
  
  <div id="h" style="position:absolute;left:100;top:350;">
  <img src=http://javascript.internet.com/img/cards/hearts.gif name="h">
  </div>
  
  Just click and hold the 4 suit images to the left and then you can move them around the page!
  
  <p><center>
  <font face="arial, helvetica" size="-2">Free JavaScripts provided
  
  by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
  </center><p>
  
  <!-- Script Size:  1.99 KB -->
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 27.09.2025 - 18:39