Problem mit DHTML Drag&Drop bei Wertübergabe

I

i125

Hallo zusammen,

ich nutze die Drag&Drop Funktion von http://www.walterzorn.de/dragdrop/api.htm, der Einbau gestalltete sich recht simpel. Probleme bereitet mir die Übergabe der Variable:

Diese JSFunktion, überschreibt den Inhalt der versteckten Felder im Formular "logoposition". Ich habe es getestet und es funktioniert auch!

HTML:
 <script type="text/javascript">
    function saveimageposition(){
      window.document.logoposition.IDimgW.value = dd.elements.['IMG-872467290'].h;
      window.document.logoposition.IDimgH.value = dd.elements.['IMG-872467290'].w;
      window.document.logoposition.IDimgX.value = dd.elements.['IMG-872467290'].x;
      window.document.logoposition.IDimgY.value = dd.elements.['IMG-872467290'].y; 
    }
 </script>

Die Funktion "saveimageposition()" wird über den Submitbutton aufgerufen, funktioniert ebenfalls.

HTML:
    <form action="product.php" method="post" enctype="multipart/form-data" name="logoposition">
     <input name="IDimgX" value="" type="hidden">
     <input name="IDimgY" value="" type="hidden">
     <input name="IDimgH" value="" type="hidden">
     <input name="IDimgW" value="" type="hidden">
     <input type="submit" name="submit" value="save" onmouseover="saveimageposition()">
    </form>

Nun mein Problem an der Geschichte:
Das Object "dd.elements.['IMG-872467290'].y" ist leer?! Hab ich da was übersehen, vergessen was zu setzten? Keines der Objecte hat einen Wert.

Um den Fehler einzugrenzen hab ich es mal so versucht, das ging auch:
HTML:
<a class="code" href="javascript:void(0)" onclick="if(window.dd &amp;&amp; dd.elements) alert(dd.elements['IMG-872467290'].w);return false;">TEST</a>

Ich hoffe, dass ihr mir helfen könnte.

Grüsse

Alexander

Der geparste Code:
HTML:
 ///<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
 <head>
  <title>Unbenanntes Dokument</title>
  <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  <style type="text/css">
   img, div { behavior: url(iepngfix.htc) }
  </style>
  <script type="text/javascript">
   <!--
    function show(divid) {
     document.getElementById("IDmepload").style.display="none";
     document.getElementById(divid).style.display="inline";
    }
   //-->
  </script>

  <link href="./db/template/default/style.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <script type="text/javascript" src="./wz_dragdrop.js">
    function saveimageposition(){
      window.document.logoposition.IDimgW.value = dd.elements.['IMG-872467290'].h;
      window.document.logoposition.IDimgH.value = dd.elements.['IMG-872467290'].w;
      window.document.logoposition.IDimgX.value = dd.elements.['IMG-872467290'].x;
      window.document.logoposition.IDimgY.value = dd.elements.['IMG-872467290'].y; 
    }
  </script>

  <div id="IDX1" style="position:absolute; left:0; top:100; width:724px; height:474; background-image:url(./db/template/default/bg.gif); z-index:1;"></div>
   <div id="IDX2" style="position:absolute; left:0; top:100; width:724px; height:23; border-top: 1px solid black; background-image:url(./db/template/default/topline.png); z-index:2;"></div>
   <div id="IDX3" style="position:absolute; left:0; top:133; width:724px; height:441; border-bottom: 1px solid black; background-image:url(./db/template/default/product%20background.png); z-index:3;"></div>
   <div id="IDPRODUCTS" style="position:absolute; left:0px; top:495px; width:719px; height:78px; z-index:99; overflow: auto;">

    <a href="product.php?product=1"><img style="width: 110; height: 34;" alt="1" title="1"src="./db/imgdb/sf_085005.png" border="0"></a>
<a href="product.php?product=2"><img style="width: 110; height: 37;" alt="1" title="1"src="./db/imgdb/sf_085009.png" border="0"></a>
<a href="product.php?product=3"><img style="width: 110; height: 37;" alt="1" title="1"src="./db/imgdb/sf_085010.png" border="0"></a>
<a href="product.php?product=4"><img style="width: 110; height: 34;" alt="1" title="1"src="./db/imgdb/sf_085017.png" border="0"></a>
<a href="product.php?product=5"><img style="width: 110; height: 37;" alt="1" title="1"src="./db/imgdb/sf_085028.png" border="0"></a>

   </div>
   <div id="IDGROUPNAME3" style="position:absolute; left:15px; top:127px; width:510; height:22; z-index:6"> 
    <table style="width:250px; height:22px;" border="0" cellpadding="0" cellspacing="0">
     <tr valign="bottom" class="groups"> 
      <td><span class="groups">USB-Sticks</span></td>
      <td><span class="wgroups">MP3 Player</span></td>

      <td></td>
      <td> <a class="code" href="javascript:void(0)" onclick="if(window.dd &amp;&amp; dd.elements) alert(dd.elements['IMG-872467290'].w);return false;">TSS</a>
</td>
     </tr>
    </table>
   </div>
  <div id="IDHEAD" style="position:absolute; left:0; top:0; width:724; height:100; z-index:4">
   <table style="width:240px; height:100px;" border="0" cellpadding="0" cellspacing="0">

    <tr>
     <td valign="bottom"><img src="./db/template/default/logo.gif" width="229" height="74" alt="companylogo"></td>
    </tr>
   </table>
  </div>
  <div id="IDCOLOR" style="position:absolute; left:8px; top:377px; width:106px; height:66px; z-index:5">
   <span class="iteminfobold">
    Standard-Farbe:
   </span>

   <br>
   <table style="text-align: left; width: 12px; height: 10px; " border="0" cellpadding="0" cellspacing="1">
 <tbody>
<tr class="colortag">
<td style="background-color: #3F2893;border-color:gray; border-style:solid; border-width:0px;" class="groupbox">
<a href="product.php?swcolor=3F2893" title="2746"><img alt="#3F2893" title="Pantone: 2746" src="./db/image/color.gif"style="width: 13px; height: 10px; border:0;"></a>
</td>
<td style="background-color: #E8112D;border-color:gray; border-style:solid; border-width:0px;" class="groupbox">
<a href="product.php?swcolor=E8112D" title="185"><img alt="#E8112D" title="Pantone: 185" src="./db/image/color.gif"style="width: 13px; height: 10px; border:0;"></a>
</td>
<td style="background-color: #F96B07;border-color:gray; border-style:solid; border-width:0px;" class="groupbox">
<a href="product.php?swcolor=F96B07" title="1585"><img alt="#F96B07" title="Pantone: 1585" src="./db/image/color.gif"style="width: 13px; height: 10px; border:0;"></a>
</td>
<td style="background-color: #007A3D;border-color:gray; border-style:solid; border-width:0px;" class="groupbox">

<a href="product.php?swcolor=007A3D" title="356"><img alt="#007A3D" title="Pantone: 356" src="./db/image/color.gif"style="width: 13px; height: 10px; border:0;"></a>
</td>
<td style="background-color: #C6C1B2;border-color:gray; border-style:solid; border-width:0px;" class="groupbox">
<a href="product.php?swcolor=C6C1B2" title="413"><img alt="#C6C1B2" title="Pantone: 413" src="./db/image/color.gif"style="width: 13px; height: 10px; border:0;"></a>
</td>
<td style="background-color: #0A0C11;border-color:gray; border-style:solid; border-width:0px;" class="groupbox">
<a href="product.php?swcolor=0A0C11" title="433 2X "><img alt="#0A0C11" title="Pantone: 433 2X " src="./db/image/color.gif"style="width: 13px; height: 10px; border:0;"></a>
</td>
</tr>
</tbody>
</table>

  </div>
  <div id="IDMENUE3" style="position:absolute; left:426px; top:104px; width:289px; height:19px; z-index:6" class="iteminfobold">
   Kontakt 
   | 
   FAQ 
   | 
   AGB's 
   | 
   Anbieterkennzeichnung
  </div>

  <div id="ID-1897550687" style="position:absolute; left:195.5px; top:210.5px; width:233px; height:78px; border-width: 1px; border-color:gray; border-style:solid;  z-index:60;">
 
</div><div id="ID-1003918779" style="position:absolute; left:70.5px; top:185.5px; width:400px; height:135px;  background-color:#F96B07;  z-index:50;">
 
</div><div id="ID368072421" style="position:absolute; left:70.5px; top:185.5px; width:400px; height:135px;  z-index:51;">
 <img style="width: 400; height: 135;" alt="product"src="./db/imgdb/bf_085009.png" border="0">
</div>
  <div id="IDLOGOS" style="position:absolute; left:125px; top:490px; width:200px; height:50px; z-index:5; overflow: auto;">
   
  </div>
  <div id="IDPROPERTIES" style="position:absolute; left:336px; top:377px; width:200px; height:66px; z-index:5">
   {PROPERTIES}
  </div>

  <div id="IDPRICE" style="position:absolute; left:554px; top:377px; width:160px; height:66px; z-index:5"> 
   <div align="right">
    {PRICE}
    <form action="product.php" method="post" enctype="multipart/form-data" name="logoposition">
     <input name="IDimgX" value="" type="hidden">
     <input name="IDimgY" value="" type="hidden">
     <input name="IDimgH" value="" type="hidden">
     <input name="IDimgW" value="" type="hidden">
     <input type="submit" name="submit" value="save" onmouseover="saveimageposition()">
    </form>

   </div>
  </div>
  <div id="IDINFO3" style="position:absolute; left:554px; top:157px; width:160px; height:66px; z-index:6"> 
   <table width="160" border="0" cellpadding="0" cellspacing="0">
    <tr> 
     <td height="30" colspan="2"> 
      <div align="right" class="iteminfoheadline" style="border-bottom: 2px dotted gray;">
       <span class="iteminfotext">
        Artikel: 
       </span>
       085009
      </div>

     </td>
    </tr>
    <tr> 
     <td width="70" height="18" class="iteminfobold">Produkt: </td>
     <td height="18" class="iteminfotext">USB-Sticks</td>
    </tr>
    <tr> 
     <td width="70" height="18" class="iteminfobold">Material: </td>

     <td height="18" class="iteminfotext">Kunstoff</td>
    </tr>
    <tr> 
     <td height="18" colspan="2" class="iteminfotext" style="border-top: 2px dotted gray;">
      Mobiler Datenspeicher, USB 1.1 und 2.0 Standard. Läuft unter allen gänigen Betriebsystemen mit Plug &amp; Play
     </td>
    </tr>
   </table>

  </div>
  <div id="IDGROUPNAME" style="position:absolute; left:15px; top:459px; width:220; height:18px; z-index:4" class="groups">Produktauswahl</div>
  <div id="IDLCOLOR" style="position:absolute; left:8px; top:349px; width:106px; height:20; z-index:5" class="groups">Farbe</div>
  <div id="IDLLOGOS" style="position:absolute; left:125px; top:349px; width:200px; height:20; z-index:5;" class="groups">Logo</div>
  <div id="IDLPROPERTIES" style="position:absolute; left:336px; top:349px; width:200px; height:20; z-index:5" class="groups">Ausstattung</div>
  <div id="IDmepload" style="position:absolute; display:none; left:125px; top:377px; width:200px; height:66px; z-index:101; overflow: none; border-width: 1px; border-color:gray; border-style:solid;">
   <table style="text-align: left; width: 100%; background-color: #FFFFFF; layer-background-color: #FFFFFF;" border="0" cellpadding="0" cellspacing="0">

    <tbody>
     <tr>
      <td></td>
      <td></td>
     </tr>
     <tr>
      <td colspan="2">
       <form action="product.php" method="post" enctype="multipart/form-data" name="uploader">
        <input type="file" name="file" style="background-color: white; BORDER-RIGHT: black thin solid; BORDER-LEFT: black thin solid; BORDER-TOP: black thin solid; BORDER-BOTTOM: black thin solid; font-size: 9px">

        <br>
        <input type="submit" name="submit" value="Hochladen" style="BORDER-RIGHT: black thin solid; BORDER-LEFT: black thin solid; BORDER-TOP: black thin solid; BORDER-BOTTOM: black thin solid; font-size: 9px">
       </form>
      </td>
     </tr>
    </tbody>
   </table>
  </div>
  <div id="IDMENUE" style="position:absolute; left:4px; top:102px; width:289px; height:19px; z-index:6" class="iteminfobold">

   Produktauswahl 
   | 
   Konfiguration 
   | 
   Bestellung
  </div>

  <div id="IDPRODUCTVIEW" style="position:absolute; left:370px; top:160px; width:152px; height:19px; z-index:6;" class="iteminfobold">
   <div align="right">
    <a class="ak_iteminfotext" href="product.php?pview=FRONT">Vorderseite</a> 
    | 
    <a class="da_iteminfotext" href="product.php?pview=BACK">R&uuml;ckseite</a>
   </div>

  </div>
  <div id="IDUPLOAD5" style="position:absolute; left:125px; top:377px; width:200px; height:68px; z-index:6; overflow: auto;">
   <table style="text-align: left; width: 100%; height: 48px;  " border="0" cellpadding="2" cellspacing="0">
 <tbody>
  <tr>
   <td><img style="width: 10; height: 48;" alt="left" title="left"src="./db/template/default//lbrd.png" border="0"><a class="iteminfotext"href="product.php?logo=dec5478fac10f4f29e225cb1b67c6876+1968775320.png"><img style="width: 110; height: 48;" alt="Logo" title="Logo"src="./db/tmp//dec5478fac10f4f29e225cb1b67c6876+1968775320.png" border="0"></a><img style="width: 10; height: 48;" alt="right" title="right"src="./db/template/default//rbrd.png" border="0"></td>

   <td><img style="width: 10; height: 48;" alt="left" title="left"src="./db/template/default//lbrd.png" border="0"><a class="iteminfotext"href="product.php?logo=dec5478fac10f4f29e225cb1b67c6876+1306839011.png"><img style="width: 110; height: 48;" alt="Logo" title="Logo"src="./db/tmp//dec5478fac10f4f29e225cb1b67c6876+1306839011.png" border="0"></a><img style="width: 10; height: 48;" alt="right" title="right"src="./db/template/default//rbrd.png" border="0"></td>

   <td><a class="iteminfotext" onmouseover="show('IDmepload')" href="upload.php">Logo hochladen.</a></td>

  </tr>
 </tbody>
</table>

  </div>
  <div id="ID-872467290" style="position:absolute; left:195.5px; top:210.5px; width:px; height:px;  z-index:61;">
 <img name="IMG-872467290" style="width: 181; height: 62;" alt="" src="./db/tmp//dec5478fac10f4f29e225cb1b67c6876+1968775320.png">
</div>
<script type="text/javascript">
<!--
SET_DHTML(CURSOR_MOVE,RESIZABLE,"ID-872467290"+NO_DRAG,"IMG-872467290"+SCALABLE+MAXWIDTH+233+MAXHEIGHT+78+MINHEIGHT+20+MAXOFFLEFT+0+MAXOFFTOP+0+MAXOFFRIGHT+233+MAXOFFBOTTOM+78);
//-->
</script>
 </body>

</html>
 
Zuletzt bearbeitet von einem Moderator:
Hallo,

ok es hat sich erledigt: Wer lesen kann ist klar im Vorteil:

Statt:
HTML:
 window.document.logoposition.IDimgW.value = dd.elements.['IMG-872467290'].h;

Macht man das so:
HTML:
 window.document.logoposition.IDimgW.value = dd.elements['IMG-872467290'].h;

Der Punkt nach dem dd.elements ist fehl am Platz... sorry

CUAB
 

Neue Beiträge

Zurück