Código HTML:
<html> <head> <title>Todoenlaces.org - Comentarios</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" type="text/css" href="imagenes/estilos.css"> <script language="javascript" src="complementos/isiAJAX.js"></script> <script language="javascript"> function Envia(asunto, nick, comentario) { if (asunto.value == '' || nick.value == '' || comentario.value == '') alert('Rellene Todos los Campos'); else { myajax.Form('comentario', 'principal', 1); asunto.value = ''; nick.value = ''; comentario.value = ''; } } </script> <style type="text/css"> <!-- body { background-image: url(../imagenes/fondo.png); } --> </style></head> <body onLoad="myajax = new isiAJAX('main', 'cargador');"> <div id="cargador"> </div> <div align="center" id="principal"> <? include('complementos/conectar.php'); $comenta = mysql_query("SELECT fecha, nick, asunto, comentario FROM comentarios", $conexion); $i=0; while ($comentarios = mysql_fetch_row($comenta)) { $i++; ?> <div> <table width="500" border="0" cellpadding="3" cellspacing="5" style="border:1px solid #888; background-color:#FFF"> <tr> <td colspan="3" class="titulo" style="color:#dfe1ef; font-size:12px"><b><?=$comentarios[2];?></b></td> </tr> <tr> <td width="33%" class="td"><b><?=$comentarios[1];?></b></td> <td width="8%" class="td"><b><?=date("d/m/Y G:i", $comentarios[0]);?></b></td> </tr> <tr> <td colspan="3" class="td" style="text-align:left; padding:10px"><?=$comentarios[3];?></td> </tr> </table> </div> <br> <? } mysql_close(); ?> </div> <br><br> <div align="center"> <form id="comentario" method="post" action="comentario.php" onSubmit="Envia(this.asunto, this.nick, this.comentario); return false;"> <table width="500" border="0" style="border:2px solid #145086; background-color:#FFF"> <tr> <td class="td" width="375">Asunto<br> <input type="text" class="input" name="asunto" style="width:370px" maxlength="50"></td> <td width="115" class="td" align="left">Nick<br><input type="text" class="input" name="nick" maxlength="30"></td> </tr> <tr> <td class="td" colspan="2"><textarea class="input" style="width:480px; height:100px; padding:5px" name="comentario"></textarea></td> </tr> <tr> <td colspan="2" align="center"><input type="submit" value="Enviar" class="boton"></td> </tr> </table> </form> </div> </body> </html>