JavaScript - Ventana emergente CONFIRMAR ELIMINAR

 
Vista:
Imágen de perfil de chelo

Ventana emergente CONFIRMAR ELIMINAR

Publicado por chelo (3 intervenciones) el 15/09/2014 18:00:53
Hola buenas tardes.. tengo la siguiente lista de socios en la que hay un boton para eliminar un registro. Como puedo hacere para que al presionar en borrar me aparezca una ventana de confirmacion para borrar el registro?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Lista Socios</title>
<link rel="stylesheet" type="text/css" href="http://localhost/mutual/css/tablalistado.css">
<style>
input {cursor: pointer;}
</style>
</head>
<body background="http://localhost/mutual/imagenes/imagen_01.jpg">
<center>
<font color="#000000"><h1><p align="center">LISTADO DE SOCIOS</p></h1></font>
<table align="center" width="800" border="0" bgcolor="#FF6600">
  <tr>
    <td><label for="buscador"><strong>Buscar:</strong></label> <input type="text" class="texto-gris" id="buscador" placeholder="palabra asociada" size="35"/></td>
    <td><input type="button" value="Descargar lisa a Excel" onClick="window.location.href='http://localhost/mutual/imprimir_lista_socios.php'"></td>
    <td><input type="button" value="Volver a la Administracion" onClick="window.location.href='http://localhost/mutual/abm_administ.php'"></td>
    <td><input type="button" value="Agregar Socio" onClick="window.location.href='http://localhost/mutual/socios/alta_socio.php'"></a></td>';</td>
  </tr>
</table>
<br>
<center>
<?php
include("conexion.php");

$registros=mysql_query("SELECT id_socio,apellido_nombre,dni,domicilio,localidad,provincia,telefono_fijo,celular,fecha_nac,fecha_ingreso,estado,estado_civil,grupo_familiar FROM socios ORDER BY apellido_nombre ASC",$conexion) or die ("Problemas en el select:".mysql_error());

echo '<table border="0" class="tablalistado" id="tabla_lista_socios">';
echo '<thead>';
echo '<tr>
          <th>Nº SOCIO</th>
          <th>APELLIDO Y NOMBRE</th>
          <th>DNI</th>
          <th>GRUPO FAMILIAR</th>
          <th>DOMICILIO</th>
          <th>LOCALIDAD</th>
          <th>PROVINCIA</th>
          <th>TELEFONO</th>
          <th>CELULAR</th>
          <th>FECHA NACIMIENTO</th>
          <th>FECHA INGRESO</th>
          <th>ESTADO</th>
          <th>ESTADO CIVIL</th>
          <th colspan="3">OPCIONES</th>
      </tr>';
echo '</thead>';
echo '<tbody>';
 
while($reg=mysql_fetch_array($registros))
{
 
  echo "<tr class=\"alternar\">";
  echo "<td><center>$reg[id_socio]</center></td>";
  echo "<td><center>$reg[apellido_nombre]</center></td>";
  echo "<td><center>$reg[dni]</center></td>";
  echo "<td><center>$reg[grupo_familiar]</center></td>";
  echo "<td><center>$reg[domicilio]</center></td>";
  echo "<td><center>$reg[localidad]</center></td>";
  echo "<td><center>$reg[provincia]</center></td>";
  echo "<td><center>$reg[telefono_fijo]</center></td>";
  echo "<td><center>$reg[celular]</center></td>";
  echo "<td><center>$reg[fecha_nac]</center></td>";
  echo "<td><center>$reg[fecha_ingreso]</center></td>";
  echo "<td><center>$reg[estado]</center></td>";
  echo "<td><center>$reg[estado_civil]</center></td>";
  echo '<td><a href="http://localhost/mutual/socios/baja_socio.php?dni='.$reg['dni'].'"><input type="button" value="Borrar"></a></td>';
  echo '<td><a href="http://localhost/mutual/socios/modificar_socio1.php?dni='.$reg['dni'].'"><input type="button" value="Modificar"></a></td>';
  echo '</tr>';
}
echo "</tbody>";
echo "</table>";
 
if(isset($_REQUEST['ok']))
{
 if($_REQUEST['ok']==1)
 {
?>
</div>
      <script language="javascript" type="text/javascript">
        //<!-- <![CDATA[
        function msgbox(mensaje) {
                alert(mensaje);
        };
        // ]]> -->
      </script>
      <?php
        echo "<script>msgbox(\"SE MODIFICO UN SOCIO CORRECTAMENTE\");</script>";
  }
  else{
	   if($_REQUEST['ok']==2)
	   {
		  ?>
      <script language="javascript" type="text/javascript">
        //<!-- <![CDATA[
        function msgbox(mensaje) {
                alert(mensaje);
        };
        // ]]> -->
      </script>
      <?php
		echo "<script>msgbox(\"SE AGREGO UN SOCIO CORRECTAMENTE\");</script>";
	    }
		else
		{
      if($_REQUEST['ok']==3)
     {
      ?>
      <script language="javascript" type="text/javascript">
        //<!-- <![CDATA[
        function msgbox(mensaje) {
                alert(mensaje);
        };
        // ]]> -->
      </script>
      <?php
    echo "<script>msgbox(\"SE BORRO UN SOCIO CORRECTAMENTE\");</script>";
	    }
 
	  }
  }
}
echo "<center>";
 
mysql_close($conexion);
 
?></td>
  </tr>
</table>
  <script language="javascript" type="text/javascript">
        //<!-- <![CDATA[
        function msgbox(mensaje) {
                alert(mensaje);
        };
        // ]]> -->
      </script>
</center>
</body>
<script type="text/javascript" src="http://localhost/mutual/js/jquery.js"></script>
<script type="text/javascript">
jQuery(document).ready(function(){
  filas_cebra('tbody tr:odd', 'impar');
});
 
//función para aplicar la clase
function filas_cebra(selector, clase){
  jQuery(selector).removeClass(clase).addClass(clase);
}
 
jQuery('.texto-gris').each(function() {
    var valorActual = jQuery(this).val();
 
    jQuery(this).focus(function(){
        if( jQuery(this).val() == valorActual ) {
            jQuery(this).val('');
            jQuery(this).removeClass('texto-gris');
        };
    });
 
    jQuery(this).blur(function(){
        if( jQuery(this).val() == '' ) {
            jQuery(this).val(valorActual);
            jQuery(this).addClass('texto-gris');
        };
    });
});
 
 
jQuery("#buscador").keyup(function(){
    if( jQuery(this).val() != ""){
        jQuery("#tabla_lista_socios tbody>tr").hide();
        jQuery("#tabla_lista_socios td:contiene-palabra('" + jQuery(this).val() + "')").parent("tr").show();
    }
    else{
        jQuery("#tabla_lista_socios tbody>tr").show();
    }
});
 
jQuery.extend(jQuery.expr[":"],
{
    "contiene-palabra": function(elem, i, match, array) {
        return (elem.textContent || elem.innerText || jQuery(elem).text() || "").toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
    }
});
</script>
 
</html>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder