He leído otros post de este foro sobre este tema pero no me aclaro. Tengo este código
Código:
<html>
<head>
<script language="JavaScript">
function pregunta()
{
rpta = confirm("¿Está seguro?");
if (rpta) form.resultado.value=eval(form.expr.value);
return rpta;
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript" language="JavaScript1.2" src="js/menu.js"></script>
<!-- HOJA DE ESTILOS -->
<link href="css/estilo.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.Estilo12 {
font-size: 24px;
font-weight: bold;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
.Estilo24 {font-size: 16px}
body { background-image: url("labe.jpg");
background-repeat: no-repeat; }
</style>
</head>
<body>
<table width="980" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="205" height="44" align="center" class="azul"><a class="azul" href="agenda/index.php"><font size="3" face="Verdana, Arial, Helvetica, sans-serif">Calendario</font></a></td>
<td width="205" height="44" align="center" class="azul"><a class="azul" href="contacto.php"><font size="3" face="Verdana, Arial, Helvetica, sans-serif">Contacto</font></a></td>
</tr>
<tr>
<td height="18" colspan="5" align="center" valign="bottom"> </td>
</tr>
</table>
<br>
<?
//Conexion con la base
mysql_connect("localhost","root","");
//Ejecutamos la sentencia SQL
$result=mysql_db_query("perip","select * from hitos");
?>
<table width="100%" border="1">
<tr>
<th width="11%" bgcolor="#63cf31" class="verde">Estado</th>
<th width="28%" bgcolor="#63cf31" class="verde">Observaciones</th>
<th width="10%" bgcolor="#63cf31" class="verde">Borrar</th>
</tr>
<tr>
<?
//Mostramos los registros
while ($row=mysql_fetch_array($result))
{
echo "<tr><td width='75'><font color='#CE6131'>$row[Estado]</font></td>
<td width='300'><font color='#CE6131'>$row[Observaciones]</a></font></td>
<td> <a class='amarillo' href='borrar3.php?id=$row[id]''<script languaje=javacript>onClick= pregunta();</script>' >Borrar </a></td></tr>";
}
mysql_free_result($result)
?>
</tr>
</table>
</body>
</html>
Y el problema viene porque cuando pincho en el enlace que me lleva a borrar3.php quiero que se ejecute la función pregunta (es un alert), estuve probando y o se ejeuctaba al cargar la hoja o no se me ejecutaba. Muchas gracias