JavaScript probleem

Gestart doorMilan22 reacties35 weergaven

23 berichten · pagina 1 van 2

Milan

Lid · Topicstarter

Berichten
8.602
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hallo,

Kent hier iemand javascript?

Kan die ff een berichtje plaatsen?
Danku,

Milan
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Ik ken een klein beetje javascript. Maar ligt er dus aan wat je nodig hebt.. emo
0
Milan

Lid · Topicstarter

Berichten
8.602
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Het gaat om het verplaatsen van een div
0
Milan

Lid · Topicstarter

Berichten
8.602
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
We hebben het er o msn wel over
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Nah, das mij al te moeilijk smile
0
Milan

Lid · Topicstarter

Berichten
8.602
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Iemand anders?
0
Berichten
35.796
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
Misschien handiger om gewoon te vertellen wat precies je bedoeling is?
0
Milan

Lid · Topicstarter

Berichten
8.602
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik heb een scriptje gemaakt waarbij je een div met tekst kan verslepen. Als je op move zou klikken, zou de tekst die eronder staat mee moet moeten gaan met de muis etc. Alleen als er 2 of meerdere divjes staan, kun je alleen het divje met het hoogste id verplaatsen.
Voorbeeld: www.menatwar.one2xs.com/sitemaker2/edit.php?id=1

Code:

[COLOR= #0000BB]<?php[/COLOR]
 
[COLOR= #FF8000]/**
 * @author Milan Drossaerts
 * @mail -
 * @uses ONLY BY -
 * @rights License, ONLY USED BY-
 * @copyright 2009
 */[/COLOR]
[URL="http://www.php.net/include"]include[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]"config.php"[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$id[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]])&&[/COLOR] [URL="http://www.php.net/ctype_digit"]ctype_digit[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]]))
{[/COLOR]
    [COLOR= #0000BB]$id[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]];
}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"VERKEERDE GEGEVENS, MYSQL GEBLOKKEERD"[/COLOR][COLOR= #007700]);
}[/COLOR]
?>
<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;
        }
        [COLOR= #0000BB]<?php
        $sql2[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM admin WHERE pageid = "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$id[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
        [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$fetch[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql2[/COLOR][COLOR= #007700]))
        {[/COLOR]
           ?>
            var floatdiv = document.getElementById("[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$fetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]];[/COLOR] ?>");
        
        if (!divx) {
            divx = posx - parseInt(floatdiv.style.left);
            divy = posy - parseInt(floatdiv.style.top);
        }
        
        //document.getElementById("[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$fetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]];[/COLOR] ?>").style.position = absolute;
        floatdiv.style.top = posy - divy;
        floatdiv.style.left = posx - divx;
        
        document.getElementById("outputtop[COLOR= #0000BB]<?[/COLOR]php [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$fetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]];[/COLOR] ?>").value = posy ;
        document.getElementById("outputleft[COLOR= #0000BB]<?[/COLOR]php [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$fetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]];[/COLOR] ?>").value = posx;
        [COLOR= #0000BB]<?php[/COLOR]
        [COLOR= #007700]}[/COLOR]
        ?>
    }
    
}
</script>
[COLOR= #0000BB]<?php
$iQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM admin WHERE pageid = "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$id[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]" AND soort = 0"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
[COLOR= #0000BB]$tQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM admin WHERE pageid = "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$id[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]" AND soort = 1"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
?>
<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 />
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/while"]while[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$iFetch[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$iQuery[/COLOR][COLOR= #007700]))
{[/COLOR]
    ?>
    <div id="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$iFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]];[/COLOR]?>" style="top: [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$iFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]top[/COLOR][COLOR= #007700]];[/COLOR] ?>px; left: [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$iFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]left[/COLOR][COLOR= #007700]];[/COLOR] ?>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=[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$tFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]];[/COLOR] ?>" class="lbOn" onclick="document.getElementById([COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$iFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]];[/COLOR] ?>).style.visibility=hidden [COLOR= #0000BB]<?php[/COLOR]  ?>">[x]</a>
  </div>
  <img src="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$iFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]afbeeldingurl[/COLOR][COLOR= #007700]];[/COLOR] ?>" border="0" />
</div>
    [COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]}[/COLOR]
[URL="http://www.php.net/while"]while[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$tFetch[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$tQuery[/COLOR][COLOR= #007700]))
{[/COLOR]
    ?>
    <div id="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$tFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]];[/COLOR]?>" style="top: [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$tFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]top[/COLOR][COLOR= #007700]];[/COLOR] ?>px; left: [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$tFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]left[/COLOR][COLOR= #007700]];[/COLOR] ?>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=[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$tFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]];[/COLOR] ?>" class="lbOn" onclick="document.getElementById([COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$tFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]];[/COLOR] ?>).style.visibility=hidden">[x]</a>
  </div>
  [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$tFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]tekst[/COLOR][COLOR= #007700]];[/COLOR] ?>
</div>
    [COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]}[/COLOR]
?>
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
var floatdiv = document.getElementById("[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$fetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]];[/COLOR] ?>");


doordat je met while floatdiv een waarde geeft overschrijft ie zichzelf steeds
ik denk dat dat het probleem is
0
Milan

Lid · Topicstarter

Berichten
8.602
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hoe moet ik het dan doen? Mijn javascript is echt slecht
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dat weet ik ook niet, maar ik denk dat dat het probleem is
0
Milan

Lid · Topicstarter

Berichten
8.602
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dat zou idd kunnen
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
var floatdiv = document.getElementById("");

Dan maak je voor elke id een nieuwe floaatdiv aan =D
0
Milan

Lid · Topicstarter

Berichten
8.602
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Slim smile
0
Milan

Lid · Topicstarter

Berichten
8.602
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Werkt niet sadley
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren