|18111
Neues Mitglied
Hallo alle miteinander,
Ich habe ein Drag und Drop Script programmiert, doch nun will das nicht funzen. Über Hilfe würde ich mich freuen.
MfG |18111
Ich habe ein Drag und Drop Script programmiert, doch nun will das nicht funzen. Über Hilfe würde ich mich freuen.
Code:
<html>
<body>
<script type="text/javascript">
var check=0
function dragdrop(bild)
{
check=1
B=document.all;C=document.layers;
T1=new Array(bild,35,35)
nos=parseInt(T1.length/3)
file://rate=100000
for (i=0;i<nos;i++){createContainer("CUR"+i,i*10,i*10,i*3+1,i*3+2,"","[img]"+T1[i*3]+"[/img]")}
function createContainer(N,Xp,Yp,W,H,At,HT,Op,St){with (document){write((!B) ? "<layer id='"+N+"' left="+Xp+" top="+Yp+" width="+W+" height="+H : "<div id='"+N+"'"+" style='position:absolute; left:"+Xp+"; top:"+Yp+"; width:"+W+"; height:"+H+"; ");if(St){if (C)write(" style='");write(St+";' ")}else write((B)?"'":"");write((At) ? At+">" : ">");write((HT) ? HT : "");if (!Op)closeContainer(N)}}
function closeContainer(){document.write((B)?"</div>":"</layer>")}
function getXpos(N){return (B) ? parseInt(B[N].style.left) : C[N].left}
function getYpos(N){return (B) ? parseInt(B[N].style.top) : C[N].top}
function moveContainer(N,DX,DY){c=(B) ? B[N].style : C[N];c.left=DX;c.top=DY}
function cycle(){for (i=0;i<(nos-1);i++){moveContainer("CUR"+i,getXpos("CUR"+(i+1)),getYpos("CUR"+(i+1)))}}
function newPos(e){moveContainer("CUR"+(nos-1),((B)?event.clientX+document.body.scrollLeft:e.pageX)+2,((B)?event.clientY+document.body.scrollTop:e.pageY)+2)}
if(document.layers)document.captureEvents(Event.MOUSEMOVE)
else if (B)document.body.onscroll=newPos
document.onmousemove=newPos
file://setInterval("cycle()",rate);
}
function ready()
{
if(check == 1)
{
document.write("<div style='text-align:left; padding:20px; border:thin solid red; margin:25px'><h1>Klicken Sie auf dieses Bild...</h1></div><div style='text-align:left; padding:20px; border:thin solid blue; margin:25px'><h1>... und ziehen sie es nach hier!</h1><ul>[*]<img scr='deinbild.png' alt='Dein Bild'>[/list]</div>")
}
else
{
alert("Bitte erst das Bild berühren!")
}
</script>
<div style="text-align:left; padding:20px; border:thin solid red; margin:25px">
<h1>Klicken Sie auf dieses Bild...</h1>
<ul>
[*]<img scr="deinbild.png" alt="Dein Bild" onmouseover="dragdrop(deinbild.png)">
[/list]
</div>
<div style="text-align:left; padding:20px; border:thin solid blue; margin:25px">
<h1>... und ziehen sie es nach hier!</h1>
<ul>
[*]<img scr="leer.png" onMouseOver="ready()">
[/list]
</div>
Das Bild können Sie per Drag und Drop verschieben!