Hola!... Estoy haciendo una web donde se puedan monitorear imagenes de pacientes con datos, de manera que mientras se ven las fotos, se ve el progreso del paciente.
Pero tengo un problema, un dato no me lo reconoce... Y no se porque...
Aquí les dejo el "pequeño" código:
<style type="text/css">
button {
font-size:20px;
font-weight:bold;
color:blue;
}
td. Boton {
width:50px;
}
</style>
<script language="JavaScript">
var fotos=new Array();
var fechas=new Array();
var comentarios=new Array();
var i=1;
Function izquierda () {
if (i+foto. Length<fotos. Length) {
++i;
mostrar_fotos()
} else
alert("No se puede mover más a la izquierda");
}
Function derecha () {
if (i>0) {
--i;
mostrar_fotos();
} else
alert("No se puede mover más a la derecha");
}
Function mostrar_fotos() {
j=0;
for (f=i; f<i+foto. Length; ++f) {
foto[j]. Src="fotos/"+fotos[f];
fecha[j]. InnerText=fechas[f];
++j;
}
}
Function mostrar_comentario() {
comentario. Value=comentarios[i+1];
}
</script>
<center>
<h2><font color="purple"><i>Secuencia de fotos</i></font></h2>
<h3><u>Realizado por:</u> <i>Alicia Fuenzalida S. </i></h3>
<table>
<tr>
<td class="boton" align="center">
<button onclick="izquierda();">←</button>
</td>
<td align="center">
<img name="foto" src=""><br>
<b id="fecha"></b>
</td>
<td align="center">
<img name="foto" src=""><br>
<b id="fecha"></b>
</td>
<td align="center">
<img name="foto" src=""><br>
<b id="fecha"></b>
</td>
<td class="boton" align="center">
<button onclick="derecha();">→</button>
</td>
</tr>
</table>
<? Php
$conexion=mysql_connect("localhost","root","");
mysql_select_db("heridas",$conexion);
$sentenciaSQL="select * from fotos order by fecha";
$cursor=mysql_query($sentenciaSQL,$conexion);
$i=0;
while ($registro=mysql_fetch_array($cursor)) {
echo "<script language="JavaScript"> ";
echo "fotos[". $i. "]="". $registro["archivo"]. ""; ";
echo "fechas[". $i. "]="". $registro["fecha"]. ""; ";
echo "</script> ";
++$i;
}
Echo "<script language="JavaScript"> ";
echo "i=0; ";
echo "mostrar_fotos(); ";
echo "</script> ";
? >
<table>
<tr>
<td align="center">
<img src="flecha. Bmp" width="70" height="70">
</td>
<br>
</tr>
<tr>
<td>
<? Php
$conexion=mysql_connect("localhost","root","");
mysql_select_db("heridas",$conexion);
$sentenciaSQL="select comentario from fotos order by fecha";
$cursor=mysql_query($sentenciaSQL,$conexion);
$i=0;
while ($registro=mysql_fetch_array($cursor)) {
echo "<script language="JavaScript"> ";
echo "comentarios[". $i. "]="". $registro["comentario"]. ""; ";
echo "</script> ";
++$i;
}
Echo "<script language="JavaScript"> ";
echo "i=0; ";
echo "mostrar_comentario(); ";
echo "</script> ";
? >
</td>
</tr>
</table>
El problema esta en la linea que tengo con negrita... Que me dice que comentario no tiene valor o no existe... Y no se que hacer!
Ojala alguien me pueda ayudar.. De antemano... Muchísimas gracias!