PHP interesse |
|
Ik heb een script met Ajax-javascript gedoe..
daarmee kan ik een venster verslepen,
echter is het niet mogelijk om 2 venters in het scherm te zetten,
als ik dit die, klik ik op de 2de om te verplaatsen, maar de 1ste beweegt..
js:
var ie=document.all;
var nn6=document.getElementById&&!document.all;
var isdrag=false;
var x,y;
var dobj;
function movemouse(e)
{
if (isdrag)
{
dobj.style.left = nn6 ? tx + e.clientX - x : tx + event.clientX - x;
dobj.style.top = nn6 ? ty + e.clientY - y : ty + event.clientY - y;
return false;
}
}
function selectmouse(e)
{
var fobj = nn6 ? e.target : event.srcElement;
var topelement = nn6 ? "HTML" : "BODY";
while (fobj.tagName != topelement && fobj.className != "dragme")
{
fobj = nn6 ? fobj.parentNode : fobj.parentElement;
}
if (fobj.className=="dragme")
{
isdrag = true;
// dobj = fobj;
if(document.getElementById('dragcomponent'))
{
dobj = document.getElementById('dragcomponent');
}
tx = parseInt(dobj.style.left+0);
ty = parseInt(dobj.style.top+0);
x = nn6 ? e.clientX : event.clientX;
y = nn6 ? e.clientY : event.clientY;
document.onmousemove=movemouse;
return false;
}
}
document.onmousedown=selectmouse;
document.onmouseup=new Function("isdrag=false");
var ie=document.all; var nn6=document.getElementById&&!document.all; var isdrag=false; var x,y; var dobj; function movemouse(e) { if (isdrag) { dobj.style.left = nn6 ? tx + e.clientX - x : tx + event.clientX - x; dobj.style.top = nn6 ? ty + e.clientY - y : ty + event.clientY - y; return false; } } function selectmouse(e) { var fobj = nn6 ? e.target : event.srcElement; var topelement = nn6 ? "HTML" : "BODY"; while (fobj.tagName != topelement && fobj.className != "dragme") { fobj = nn6 ? fobj.parentNode : fobj.parentElement; } if (fobj.className=="dragme") { isdrag = true; // dobj = fobj; if(document.getElementById('dragcomponent')) { dobj = document.getElementById('dragcomponent'); } tx = parseInt(dobj.style.left+0); ty = parseInt(dobj.style.top+0); x = nn6 ? e.clientX : event.clientX; y = nn6 ? e.clientY : event.clientY; document.onmousemove=movemouse; return false; } } document.onmousedown=selectmouse; document.onmouseup=new Function("isdrag=false");
php:
<?
function window($id,$title,$body){
?>
<script language="javascript" src="js/DragDrop.js"></script>
<div id="<?="Window" . $id;?>" style="position:relative; width:313; height:274; top:100; left:100">
<table id="Table_01" width="500" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="8" height="19" rowspan="3">
<img src="images/01.gif" width="8" height="19" alt="" /></td>
<td background="images/02.gif" width="468" height="19" rowspan="3" class="dragme">
titel?</td>
<td width="16" height="2">
<img src="images/03.gif" width="16" height="2" alt="" /></td>
<td width="8" height="2" colspan="2">
<img src="images/04.gif" width="8" height="2" alt="" /></td>
</tr>
<tr>
<td width="19" height="12" colspan="2">
<a href="#"><img src="images/05.gif" width="19" height="12" alt="" border="0"/></a></td>
<td width="5" height="17" rowspan="2">
<img src="images/06.gif" width="5" height="17" alt="" /></td>
</tr>
<tr>
<td width="16" height="5">
<img src="images/07.gif" width="16" height="5" alt="" /></td>
<td width="3" height="5">
<img src="images/08.gif" width="3" height="5" alt="" /></td>
</tr>
<tr>
<td width="8" height="380">
<img src="images/09.gif" width="8" height="380" alt="" /></td>
<td bgcolor="808080" width="484" height="380" colspan="2">
body?</td>
<td width="8" height="380" colspan="2">
<img src="images/11.gif" width="8" height="380" alt="" /></td>
</tr>
<tr>
<td width="500" height="1" colspan="5">
<img src="images/12.gif" width="500" height="1" alt="" /></td>
</tr>
</table>
</div>
<?
}
?>
<? function window($id,$title,$body){ ?> <script language="javascript" src="js/DragDrop.js"></script> <div id="<?="Window" . $id;?>" style="position:relative; width:313; height:274; top:100; left:100"> <table id="Table_01" width="500" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="8" height="19" rowspan="3"> <img src="images/01.gif" width="8" height="19" alt="" /></td> <td background="images/02.gif" width="468" height="19" rowspan="3" class="dragme"> titel?</td> <td width="16" height="2"> <img src="images/03.gif" width="16" height="2" alt="" /></td> <td width="8" height="2" colspan="2"> <img src="images/04.gif" width="8" height="2" alt="" /></td> </tr> <tr> <td width="19" height="12" colspan="2"> <a href="#"><img src="images/05.gif" width="19" height="12" alt="" border="0"/></a></td> <td width="5" height="17" rowspan="2"> <img src="images/06.gif" width="5" height="17" alt="" /></td> </tr> <tr> <td width="16" height="5"> <img src="images/07.gif" width="16" height="5" alt="" /></td> <td width="3" height="5"> <img src="images/08.gif" width="3" height="5" alt="" /></td> </tr> <tr> <td width="8" height="380"> <img src="images/09.gif" width="8" height="380" alt="" /></td> <td bgcolor="808080" width="484" height="380" colspan="2"> body?</td> <td width="8" height="380" colspan="2"> <img src="images/11.gif" width="8" height="380" alt="" /></td> </tr> <tr> <td width="500" height="1" colspan="5"> <img src="images/12.gif" width="500" height="1" alt="" /></td> </tr> </table> </div> <? } ?>
index.php:
<?php
include ("tools/window.php");
window("1","title","file");
window("2","title","file");
?>
<?php include ("tools/window.php"); window("1","title","file"); window("2","title","file"); ?>
|