Solo funciona con this...
Publicado por Oscar (4 intervenciones) el 17/09/2009 00:27:37
Hola, en el siguiente código style.background solo me funciona con this.
Cómo hago para que funcione con una variable? variable.style.background
Gracias.
<!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=iso-8859-1" />
<title>Plantilla AK</title>
<style type="text/css">
<!--
.bdy { font-size:12px; font-family:Arial, Helvetica, sans-serif; }
-->
</style><script language="JavaScript" type="text/javascript">
var color_bg_over='#cc0';
var color_bg_pre_over='#000';
var x1="texto1";
function onover(este){
color_bg_pre_over=este.style.background;
este.style.background=color_bg_over;
}
function onout(este){
este.style.background=color_bg_pre_over;
}
</script>
</head>
<body class="bdy">
<span id="texto1" onmouseover="onover(this)" onmouseout="onout(this)">
<!--<span id="texto1" onmouseover="onover('texto1')" onmouseout="onout('texto1')">-->
<!--<span id="texto1" onmouseover="onover(x1)" onmouseout="onout(x1)">-->
klklklkl
</span>
</body>
</html>
Cómo hago para que funcione con una variable? variable.style.background
Gracias.
<!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=iso-8859-1" />
<title>Plantilla AK</title>
<style type="text/css">
<!--
.bdy { font-size:12px; font-family:Arial, Helvetica, sans-serif; }
-->
</style><script language="JavaScript" type="text/javascript">
var color_bg_over='#cc0';
var color_bg_pre_over='#000';
var x1="texto1";
function onover(este){
color_bg_pre_over=este.style.background;
este.style.background=color_bg_over;
}
function onout(este){
este.style.background=color_bg_pre_over;
}
</script>
</head>
<body class="bdy">
<span id="texto1" onmouseover="onover(this)" onmouseout="onout(this)">
<!--<span id="texto1" onmouseover="onover('texto1')" onmouseout="onout('texto1')">-->
<!--<span id="texto1" onmouseover="onover(x1)" onmouseout="onout(x1)">-->
klklklkl
</span>
</body>
</html>
Valora esta pregunta


0