My question is: can onclick events be done on links?
cambiar_estado.php
$query = "SELECT
*
FROM
usuarios_datos
WHERE
ID_OBLIGATORIO = '".$_REQUEST["Id"]."'";
$result = mysql_query($query);
//Mientras existen datos, analizamos el ID asignado extrayendo su estado
while($row = mysql_fetch_array($result)){
?>
<center>
<?php
if($row["estado"] == 0) {
echo "<a href=\"javascript:cargaXML('cambiar_estado.php?Id=".$_REQUEST["Id"]."','estado".$_REQUEST["Id"]."')\">";
echo "<img src=\"/imagenes/0.gif\">";
echo "</a>";
} else if($row["estado"] == 1) {
echo "<a href=\"javascript:cargaXML('cambiar_estado.php?Id=".$_REQUEST["Id"]."','estado".$_REQUEST["Id"]."')\">";
echo "<img src=\"/imagenes/1.gif\">";
echo "</a>";
} else {
echo "<a href=\"javascript:cargaXML('cambiar_estado.php?Id=".$_REQUEST["Id"]."','estado".$_REQUEST["Id"]."')\">";
echo "<img src=\"/imagenes/2.gif\">";
echo "</a>";
}
?>
</center>
<?php
}
mysql_free_result($result);
index.php
echo "<td width=\"08%\" id=\"estado".$row['ID_OBLIGATORIO']."\">" ?>
<!-- Columna ESTADO del usuario. -->
<center>
<?php
$estado = 1;
"<a href=\"javascript:cargaXML('cambiar_estado.php?Id=".$row['ID_OBLIGATORIO']."','estado".$row['ID_OBLIGATORIO']."')\">";
echo "<img src=\"/imagenes/".$row['estado'].".gif\">";
echo "</a>";
?>
</center>
<?php
echo "</td>";
Well my question is, in those links I can insert an onclick event so that when I click on the image .gif ask me (confirm ()) if I want to show imagen1.gif or imagen2.gif? I hope you have explained to me.