Ver Mensaje Individual
  #4 (permalink)  
Antiguo 24/12/2008, 17:18
Avatar de gabyweb
gabyweb
 
Fecha de Ingreso: enero-2002
Ubicación: Lima
Mensajes: 364
Antigüedad: 22 años, 4 meses
Puntos: 0
Pregunta Respuesta: Cómo hacer para capturar el contenido del div en una variable

He modificado el script y lo tengo de la siguiente manera:

Código PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Gallery - Image Upload</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="styles.css"/>
    <script language="JavaScript">
    //MultiPowUpload_onComplete. Invoked when the upload or download of single file operation has successfully completed
    function MultiPowUpload_onComplete(type, index, serverResponse)
    {
        addThumbnail(serverResponse);
        //acá modificamos: 
        window.contenido=document.getElementById('thumbnails'); 

        [COLOR="Red"]// Se crea un nuevo "INPUT"
        var newInput = document.createElement('image');
           newInput.type = 'hidden';
           newInput.name = 'myImage[]';
           newInput.value = window.contenido;
        //alert(newInput.value);
        document.forms[0].submit();[/COLOR]
    }

    function addThumbnail(source)
    {
        var Img = document.createElement("img");
        Img.style.margin = "5px";

        if(source != "no_image")
            Img.src = source;
        else
            Img.src = "Images/elementitlogo.gif";
        
        document.getElementById("thumbnails").appendChild(Img);
        //document.getElementById("thumbnails").innerHTML +=  "<a href=\"javascript:alert('Portada de Album')\"><img src=\"icon_photoalbum.gif\" border=\"0\"/></a>";        
    }
    </script>
</head>
<body>
<h3>Image Upload Area</h3>
<p> </p>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><form name="upload" action="image_upload.php" method="post">
<p> </p>
    <table width="32%" border="0" align="left" cellpadding="5" cellspacing="0">
        <tr>
            <td>Photo Album:</td>
            <td><select name="albums" id="albums">
                <?php
                
include("include/config.php");
                
db_connect();
                
mysql_query("SET NAMES 'utf8'");
                
header('Content-Type: text/html; charset=utf-8' );
                
                
$sql "SELECT album_id, album_name FROM album";
                
$result = @mysql_query$sql ) or die("Error retrieving records: " mysql_error());
                while ( 
$row mysql_fetch_array($result) ){
                    echo(
"<option value=" $row['album_id'] . ">" $row['album_name'] . "</option>");
                }
                
?>
                </select>
            </td>
        </tr>

        <tr>
            <td align="left" colspan="2">
                <div id="MultiPowUpload_holder">You need at least 9 version of Flash player. Download last version 
                    <a target="_blank" href="http://www.adobe.com/shockwave/download/alternates/">here</a>!
                </div>
                <!-- SWFObject home page: http://code.google.com/p/swfobject/ -->
                <script type="text/javascript" src="swfobject.js"></script>
                <script type="text/javascript">
                    var params = {  
                        BGColor: "#F8F6E6"
                    };
                    
                    var attributes = {  
                        id: "MultiPowUpload",  
                        name: "MultiPowUpload"
                    };
                    
                
                    var flashvars = {
                      //uploadUrl: "FileProcessingScripts/PHP/createthumbnail.php",
                      uploadUrl: "createthumbnail.php",
                      useExternalInterface: "Yes",
                      fileTypes: "JPEG images|*.jpg\;*.jpeg"
                    };
                    
                    swfobject.embedSWF("ElementITMultiPowUpload2.swf", "MultiPowUpload_holder", "450", "350", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
                </script>
            </td>
        </tr>
        <tr>
            <td></td>
            <td><!-- <input name="submit" type="submit" id="submit" value="Continue" /> --></td>
        </tr>
        <!--  <div id="thumbnails"></div> -->
    </table>
    <p/>
</form>
</td>
</tr>
</table>
<p/>
<table>
        <tr>
            <td colspan="2">
                <table width="*" border="0" align="left" cellpadding="3" cellspacing="0" class="bottommenu">
                    <tr>
                        <td class="bottommenu"><a href="index.php">Main Menu</a> | <a href="new_album.php">Create
                    New Album</a> | <a href="gallery.php">View Gallery</a></td>
                    </tr>
                </table>
            </td>
        </tr>
</table>
</body>
</html>
El código que está en rojo lo he añadido para que el formulario se envíe automáticamente y no lo hace.

Qué estoy haciendo mal?
__________________
Gaby :adios: