Foros del Web » Programando para Internet » Javascript »

Efecto fade in y fade out al guardar o eliminar comentario

Estas en el tema de Efecto fade in y fade out al guardar o eliminar comentario en el foro de Javascript en Foros del Web. Hola que tal, miren hice un sistema de comentarios muy sencillo, pero quiero que cuando el usuario oprima el boton de comentar, la publicacion aparesca ...
  #1 (permalink)  
Antiguo 30/08/2012, 14:47
 
Fecha de Ingreso: mayo-2012
Ubicación: Distrito Federal
Mensajes: 49
Antigüedad: 12 años
Puntos: 9
Pregunta Efecto fade in y fade out al guardar o eliminar comentario

Hola que tal, miren hice un sistema de comentarios muy sencillo, pero quiero que cuando el usuario oprima el boton de comentar, la publicacion aparesca con el efecto fade in (tipo facebook) y cuando el administrador decida borrar un comentario este desapareca con el efecto fade out.

Quiero saber como se puede hacer con jquery (o cualquier otro script).

Les pongo el codigo de mi pagina de comentarios (aclaro que no tiene formato XD)

De antemano muchas gracias por la ayuda que me puedan brindar

comentarios.php
Código:
<?php require_once('Connections/bd_futbol.php'); ?>
<?php require_once('Connections/bd_futbol.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "formcomentar")) {
  $insertSQL = sprintf("INSERT INTO comentarios (nombre, comentario) VALUES (%s, %s)",
                       GetSQLValueString($_POST['nombre'], "text"),
                       GetSQLValueString($_POST['comentario'], "text"));

  mysql_select_db($database_bd_futbol, $bd_futbol);
  $Result1 = mysql_query($insertSQL, $bd_futbol) or die(mysql_error());

  $insertGoTo = "comentarios.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}

$maxRows_comntarios = 4;
$pageNum_comntarios = 0;
if (isset($_GET['pageNum_comntarios'])) {
  $pageNum_comntarios = $_GET['pageNum_comntarios'];
}
$startRow_comntarios = $pageNum_comntarios * $maxRows_comntarios;

mysql_select_db($database_bd_futbol, $bd_futbol);
$query_comntarios = "SELECT * FROM comentarios ORDER BY comentario ASC";
$query_limit_comntarios = sprintf("%s LIMIT %d, %d", $query_comntarios, $startRow_comntarios, $maxRows_comntarios);
$comntarios = mysql_query($query_limit_comntarios, $bd_futbol) or die(mysql_error());
$row_comntarios = mysql_fetch_assoc($comntarios);

if (isset($_GET['totalRows_comntarios'])) {
  $totalRows_comntarios = $_GET['totalRows_comntarios'];
} else {
  $all_comntarios = mysql_query($query_comntarios);
  $totalRows_comntarios = mysql_num_rows($all_comntarios);
}
$totalPages_comntarios = ceil($totalRows_comntarios/$maxRows_comntarios)-1;$maxRows_comntarios = 4;
$pageNum_comntarios = 0;
if (isset($_GET['pageNum_comntarios'])) {
  $pageNum_comntarios = $_GET['pageNum_comntarios'];
}
$startRow_comntarios = $pageNum_comntarios * $maxRows_comntarios;

mysql_select_db($database_bd_futbol, $bd_futbol);
$query_comntarios = "SELECT * FROM comentarios ORDER BY idcomentarios DESC";
$query_limit_comntarios = sprintf("%s LIMIT %d, %d", $query_comntarios, $startRow_comntarios, $maxRows_comntarios);
$comntarios = mysql_query($query_limit_comntarios, $bd_futbol) or die(mysql_error());
$row_comntarios = mysql_fetch_assoc($comntarios);

if (isset($_GET['totalRows_comntarios'])) {
  $totalRows_comntarios = $_GET['totalRows_comntarios'];
} else {
  $all_comntarios = mysql_query($query_comntarios);
  $totalRows_comntarios = mysql_num_rows($all_comntarios);
}
$totalPages_comntarios = ceil($totalRows_comntarios/$maxRows_comntarios)-1;
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
<style type="text/css">
<!--
#apDiv1 {
	position:absolute;
	width:285px;
	height:115px;
	z-index:1;
	left: 466px;
	top: 14px;
}
#apDiv2 {
	position:absolute;
	width:656px;
	height:79px;
	z-index:2;
	left: 272px;
	top: 278px;
}
#apDiv3 {
	position:absolute;
	width:200px;
	height:40px;
	z-index:3;
	left: 140px;
	top: 31px;
}
-->
</style>
</head>

<body>
<div id="apDiv1">
  <form id="formcomentar" name="formcomentar" method="POST" action="<?php echo $editFormAction; ?>">
    <table width="279" border="1">
      <tr>
        <td>Nombre: 
          <label>
            <input type="text" name="nombre" id="nombre" />
        </label></td>
      </tr>
      <tr>
        <td><p>Comentario:</p>
        <p>
          <label>
            <textarea name="comentario" id="comentario" cols="30" rows="5"></textarea>
          </label>
        </p></td>
      </tr>
      <tr>
        <td><label>
          <input type="submit" name="enviar" id="enviar" value="Comentar" />
        </label></td>
      </tr>
    </table>
    <input type="hidden" name="MM_insert" value="formcomentar" />
  </form>
</div>

<div id="apDiv2">
  <?php do { ?>
    <table width="655" height="111" border="1" id="posts">
      <tr>
        <td>NOMBRE</td>
        <td>COMENTARIO</td>
      </tr>
      <tr>
        <td height="80"><?php echo $row_comntarios['nombre']; ?><br />
          <br />
        <?php echo $row_comntarios['fecha']; ?><br /></td>
        <td><?php echo $row_comntarios['comentario']; ?></td>
      </tr>
    </table>
    <?php } while ($row_comntarios = mysql_fetch_assoc($comntarios)); ?>
</div>
</body>
</html>
<?php
mysql_free_result($comntarios);
?>

Etiquetas: comentario, efecto, fade, html, input, php, select, botones
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 13:13.