Hola
michelson:
En estos casos yo soy partidario de buscar una solución cómoda. En el evento
onclick quitamos los eventos
onmouseover y
onmouseout. La manera de hacerlo bien es con
detachEvent(), pero nunca la he utilizado. Ésto es igual de funcional:
Código PHP:
<!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" xml:lang="es" lang="es">
<head>
<meta http-equiv="Content-type" content="text/html;charset=iso-8859-1" />
<meta name="Author" content="derkeNuke" />
<title>Página nueva</title>
<style type="text/css">
</style>
</head>
<body>
<button type="button" id="elBoton" style="color:green;">hola caracola</button>
<script type="text/javascript">
<!--
var btn = document.getElementById("elBoton");
btn.onmouseover = function() {
this.style.color = "red";
}
btn.onmouseout = function() {
this.style.color = "green";
}
btn.onclick = function() {
this.onmouseover = this.onmouseout = null;
alert("Me has hecho click! Ahora me quedaré para siempre en rojo!");
}
// -->
</script>
</body>
</html>
Si no puedes quitar los eventos
mouseover y
mouseout pensaremos otra cosa, pero de momento así
Un saludo.