Hallo,

Ik met Javascript een scriptje gemaakt waarmee je divs mee kan verslepen, alleen, kan je de div met het laagste id verslepen... Aangezien ik er nog niet zoveel weet heb ik geen idee hoe ik dit kan oplossen...

Alvast bedankt,

Milan

PHP Code:
<?php

/**
 * @author Milan Drossaerts
 * @mail [email protected]
 * @uses ONLY BY HTTP://WWW.-.COM/
 * @rights License, ONLY USED BY HTTP://WWW.-.COM/
 * @copyright 2009
 */
include ("config.php");
$id "";
if (isset(
$_GET['id'])&& ctype_digit($_GET['id']))
{
    
$id $_GET['id'];
}else{
    die(
"VERKEERDE GEGEVENS, MYSQL GEBLOKKEERD");
}
?>
<style>
a {
 text-decoration: none;    
 color: black;
}

/* ----- CSS ----- */

*{
    margin:0;
    padding:0;
}
body{
    margin:10px;
    font-size:80%;
    font-family:"Lucida Grande", Tahoma, sans-serif;
}
p{
    margin:0 0 1em 0;
}
a img{
    border:none !important;
}
#container{
    margin:0 auto;
    width:500px;
    padding:40px;
    text-align:left;
    background-color:#fff;
}

#lightbox h2{
    margin:0 0 1em 0;
}
#lightbox h3{
    color:#FF713F;
}
#lightbox.done p{
    color:#333;
}

#form{
    text-align:left;
    margin:25px;
}
#form ul{
    list-style:none;
}
#form li{
    margin:0 0 1em 0;
}
#form textarea{
    width:100%;
    height:150px;
}

#definition{
    margin:25px;
}
.highlight{
    background-color:#FEFFAF;
}
/* - - - - - - - - - - - - - - - - - - - - -

Title : Lightbox CSS
Author : Kevin Hale
URL : http://particletree.com/features/lightbox-gone-wild/

Created : January 13, 2006
Modified : February 1, 2006

- - - - - - - - - - - - - - - - - - - - - */

#lightbox{
    display:none;
    position: absolute;
    top:50%;
    left:50%;
    z-index:9999;
    width:500px;
    height:300px;
    padding:10px;
    margin:-220px 0 0 -250px;
    border:1px solid #fff;
    background:#FDFCE9;
    text-align:left;
}
#lightbox[id]{
    position:fixed;
}

#overlay{
    display:none;
    position:absolute;
    top:0;
    left:0;
    width:100%;
    height:100%;
    z-index:5000;
    background-color:#000;
    -moz-opacity: 0.8;
    opacity:.80;
    filter: alpha(opacity=80);
}
#overlay[id]{
    position:fixed;
}

#lightbox.done #lbLoadMessage{
    display:none;
}
#lightbox.done #lbContent{
    display:block;
}
#lightbox.loading #lbContent{
    display:none;
}
#lightbox.loading #lbLoadMessage{
    display:block;
}

#lightbox.done img{
}
</style>
<script type="text/javascript" src="add_ubb.js"></script>
<script type="text/javascript" src="lightbox_1.js"></script>
<script type="text/javascript" src="lightbox_2.js"></script>
<script type="text/javascript">
function geklicked() {
    this.mover = new mover;
    document.onmousemove = this.mover.move;
}

function losgelaten() {
    this.mover = null;
    document.onmousemove = null;
}

function mo() {
    this.mover = null;

    this.geklicked = geklicked;
    
    this.losgelaten = losgelaten;

}

function mover() {
    var divx = null;
    var divy = null;

    this.move = function(e) {

        var posx = 0;
        var posy = 0;
        if (!e) var e = window.event;
        if (e.pageX || e.pageY)
        {
            posx = e.pageX;
            posy = e.pageY;
        }
        else if (e.clientX || e.clientY)
        {
            posx = e.clientX + document.body.scrollLeft;
            posy = e.clientY + document.body.scrollTop;
        }
        <?php
        $sql2 
mysql_query("SELECT * FROM admin WHERE pageid = '" $id "'") or die(mysql_error());
        while(
$fetch mysql_fetch_assoc($sql2))
        {
           
?>
            var floatdiv = document.getElementById("<?php echo $fetch['id']; ?>");
        
        if (!divx) {
            divx = posx - parseInt(floatdiv.style.left);
            divy = posy - parseInt(floatdiv.style.top);
        }
        
        //document.getElementById("<?php echo $fetch['id']; ?>").style.position = 'absolute';
        floatdiv.style.top = posy - divy;
        floatdiv.style.left = posx - divx;
        
        document.getElementById("outputtop<?php echo $fetch['id']; ?>").value = posy ;
        document.getElementById("outputleft<?php echo $fetch['id']; ?>").value = posx;
        <?php
        
}
        
?>
    }
    
}
</script>
<?php
$iQuery 
mysql_query("SELECT * FROM admin WHERE pageid = '" $id "' AND soort = '0'") or die(mysql_error());
$tQuery mysql_query("SELECT * FROM admin WHERE pageid = '" $id "' AND soort = '1'") or die(mysql_error());
?>
<div style="position: absolute; top: 0px; left: 0px; width: 100%; background: url(editor_background.png); height: 20px;"><a href="editor_tekst_invoegen.php" class="lbOn"><center><img src="img/textfield_add.png" border="0" /><strong>Voeg tekst toe</strong></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#"><img src="img/image_add.png" border="0" /><strong>Voeg een afbeelding toe</strong></a><form action="" method="POST"><input type="submit" name="submit" value="Opslaan" /></form></center></div><br /><br />
<?php
while ($iFetch mysql_fetch_assoc($iQuery))
{
    
?>
    <div id="<?php echo $iFetch['id'];?>" style="top: <?php echo $iFetch['top']; ?>px; left: <?php echo $iFetch['left']; ?>px; position: absolute;">
  <div onmouseup="e.losgelaten(); e = null;" onmousedown="e = new mo; e.geklicked();" style="margin: 0px; background-color: transparant; cursor: pointer; text-align: left;">Move
    <a href="deleteobject.php?id=<?php echo $tFetch['id']; ?>" class="lbOn" onclick="document.getElementById('<?php echo $iFetch['id']; ?>').style.visibility='hidden' <?php  ?>">[x]</a>
  </div>
  <img src="<?php echo $iFetch['afbeeldingurl']; ?>" border="0" />
</div>
    <?php
}
while (
$tFetch mysql_fetch_assoc($tQuery))
{
    
?>
    <div id="<?php echo $tFetch['id'];?>" style="top: <?php echo $tFetch['top']; ?>px; left: <?php echo $tFetch['left']; ?>px; position: absolute;">
  <div onmouseup="e.losgelaten(); e = null;" onmousedown="e = new mo; e.geklicked();" style="margin: 0px; background-color: transparant; cursor: pointer; text-align: left;">Move
    <a href="deleteobject.php?id=<?php echo $tFetch['id']; ?>" class="lbOn" onclick="document.getElementById('<?php echo $tFetch['id']; ?>').style.visibility='hidden'">[x]</a>
  </div>
  <?php echo $tFetch['tekst']; ?>
</div>
    <?php
}
?>