Ver Mensaje Individual
  #4 (permalink)  
Antiguo 08/04/2011, 15:32
plataformas
 
Fecha de Ingreso: julio-2003
Ubicación: Santiago
Mensajes: 26
Antigüedad: 20 años, 9 meses
Puntos: 0
Respuesta: Mostrar imagen en celda tras obtener ruta desde base mysql mediante select

Corregi el problema que me daba el img

pero sigue dandome un error de codigo no definido en JAVA

TE ADJUNTO DE NUEVO EL CODIGO COMO QUEDO

JAVA

<script language="JavaScript" type="text/JavaScript">
// FUNCION VALIDA FECHA EN BLANCO
function ValNombre(pCampo)
{
// Verifica si no esta en blanco
if (pCampo == "")
{ alert("EL NOMBRE DEL LINK NO PUEDE ESTAR EN BLANCO");
document.Formulario.nombre.focus();
return false;
}
// Devuelve validación sin errores
return true;
}
// VALIDA TITULO EN BLANCO
function ValVinculo(pCampo)
{
// Verifica si no esta en blanco
if (pCampo == "" || pCampo.length == 0)
{ alert("EL VINCULO DEL LIN NO PUEDE ESTAR EN BLANCO");
document.Formulario.vinculo.focus();
return false;
}
// Devuelve validación sin errores
return true;
}
<!--FIN FUNCIONES -->
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// FUNCION MUESTRA IMAGEN
function r(sel) {
if(sel.selectedIndex == 0) {
document.getElementById("mostrar").src = "fotosl/default.jpg";
}
codigo.value=sel.options[sel.selectedIndex].getAttribute('codigo');
nombre.value=sel.options[sel.selectedIndex].getAttribute('nombre');
vinculo.value=sel.options[sel.selectedIndex].getAttribute('vinculo');
ruta.value=sel.options[sel.selectedIndex].getAttribute('ruta');
document.getElementById("mostrar").src = sel.options[sel.selectedIndex].getAttribute('ruta');
}
</script>

HTML

<table border="0" align="center">
<tr>
<form name="Formulario" method="post" action="actualizalink.php" enctype="multipart/form-data">
<td style="font-family:Tahoma, Geneva, sans-serif; font-size:12px; color:#930; font-weight: bold;" width="140" height="20" align="left"><span class="Estilo6"><strong>Seleccionar Link</strong></span></td>
<td width="371">
<?php
mysql_query("SET NAMES 'utf8'"); //selecciona el cotejamiento de la base de datos mysql_select_db("universidad",$link);
$cadena = mysql_query("SELECT * FROM links ORDER BY id ASC",$link);
?>

<select name="selecnot" id="selecnot" onChange="r(this)"> <option value="0" responsable="">Seleccione Link </option>

<?php
while ($row = mysql_fetch_assoc($cadena))
{
?>
<option value="<?php echo $row['id']?>"codigo="<?php echo $row['id']?>"nombre="<?php echo $row['nombre']?>"vinculo="<?php echo $row['vinculo']?>"ruta="<?php echo $row['ruta']?>" > <?php echo $row['nombre']?>
</option>
<?php
}
?>
</select>
<label> <input name="codigo" type="hidden" id="codigo" /> </label>
</td>
</tr>
<!-- AQUI QUIERO QUE SE MUESTRE LA IMAGEN QUE CORRESPONDE A LA OPCION ELEGIDA DEL SELECT --> <tr> <td style="font-family:Tahoma, Geneva, sans-serif; font-size:12px; color:#930; font-weight: bold;" width="140" align="left">Imagen Actual</td>

<td align="left">
<img id="mostrar" name="fotolink" src="fotol/default.jpg" alt="IMAGEN LINK" height='80' width='180' align='center' />
</td>
</tr>
<!-- fin de la muestra de imagen -->
<tr>
<td style="font-family:Tahoma, Geneva, sans-serif; font-size:12px; color:#930; font-weight: bold;" width="140" align="left">Nombre Link</td>
<td align="left"><input name="nombre" id="nombre" type="text" size="50" maxlength="50" style="font-family:Verdana, Geneva, sans-serif; font-size:11px; color:#F60;" onChange="ValNombre(this.value);"/></td>
</tr>
<tr>
<td style="font-family:Tahoma, Geneva, sans-serif; font-size:12px; color:#930; font-weight: bold;" align="left">Vinculo</td>
<td align="left"><input name="vinculo" id="vinculo" type="text" size="50" maxlength="50" style="font-family:Verdana, Geneva, sans-serif; font-size:11px; color:#F60;" onChange="ValVinculo(this.value);"/></td>
</tr>
<tr>
<td style="font-family:Tahoma, Geneva, sans-serif; font-size:12px; color:#930; font-weight: bold;" align="left">Ruta Imagen</td>
<td align="left">
<input name="ruta" type="text" id="ruta" value="" size="50" maxlength="50" style="font-family:Verdana, Geneva, sans-serif; font-size:11px; color:#F60;" />
</td>
</tr>
<tr>
<td style="font-family:Tahoma, Geneva, sans-serif; font-size:12px; color:#930; font-weight: bold;" width="292" align="left">Seleccionar nueva Imagen</td>
<td align="left"><input type="file" name="imagen" size="36"></td>
</tr>
<tr>
<td height="40" align="center"><input type="submit" name="act" value="Actualizar Link"/></td>
</tr>
</form>
</tr>
</table>


ESPERO ME PUEDAS AYUDAR GRACIAS