chaosyndrome
01-28-2005, 11:43 AM
ok guys, i have a little trouble getting this to work like i want to.
i'm sure it's pretty easy, but i've tryed to solve it and searching but i can't find a solution.
javascript is still new to me, so i'm sure it's why i can get this to work properly.
i'm trying to learn it, but is somewhat dificult when you're learning by yourself.
the code bellow works fine, i got the script from the web, can't recall where.
what i want to do is when you do the mouseover function on the 'contactos_botao' div, the image on the 'contactos_text' div will run the script.
i just can't get it to target the div.
thank you for all the help.
<!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>image opacity test</title>
<style type="text/css">
body {
background-color:#FFFFFF;
}
#horizon {
position: absolute;
top: 50%;
left: 0px;
width: 100%;
height: 1px;
display: block;
}
#container {
position: absolute;
width: 600px;
height: 380px;
margin-left: -300px;
top: -190px;
left: 50%;
}
#contactos_botao {
width: 35px;
height: 52px;
position: absolute;
top: 85px;
left: 150px;
}
#contactos_texto {
width: 138px;
height: 28px;
position: absolute;
top: 100px;
left: 0px;
}
</style>
<script language="JavaScript1.2">
function high(which2)
{
theobject=which2
highlighting=setInterval("highlightit(theobject)",20)
}
function low(which2)
{
clearInterval(highlighting)
which2.filters.alpha.opacity=0
}
function highlightit(cur2)
{
if (cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=17
else if (window.highlighting)
clearInterval(highlighting)
}
</script>
</head>
<body>
<!--
style="filter:alpha(opacity=50);-moz-opacity:1" onMouseover="high(this)" onMouseout="low(this)"
so the image would look like this:
<img src="image url" style="filter:alpha(opacity=0);-moz-opacity:1" onMouseover="high(this)" onMouseout="low(this)" border="0" width="600" height="380">
/-->
<div id="horizon">
<div id="container">
<div id="contactos_botao">
<img src="http://xorisso.home.sapo.pt/html/contactos_botao.gif" style="filter:alpha(opacity=0); -moz-opacity:1; border:2px;" onmouseover="high(this)" onmouseout="low(this)" />
</div>
<div id="contactos_texto">
<img src="http://xorisso.home.sapo.pt/html/contactos_text.gif" />
</div>
</div>
</div>
</body>
</html>
i'm sure it's pretty easy, but i've tryed to solve it and searching but i can't find a solution.
javascript is still new to me, so i'm sure it's why i can get this to work properly.
i'm trying to learn it, but is somewhat dificult when you're learning by yourself.
the code bellow works fine, i got the script from the web, can't recall where.
what i want to do is when you do the mouseover function on the 'contactos_botao' div, the image on the 'contactos_text' div will run the script.
i just can't get it to target the div.
thank you for all the help.
<!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>image opacity test</title>
<style type="text/css">
body {
background-color:#FFFFFF;
}
#horizon {
position: absolute;
top: 50%;
left: 0px;
width: 100%;
height: 1px;
display: block;
}
#container {
position: absolute;
width: 600px;
height: 380px;
margin-left: -300px;
top: -190px;
left: 50%;
}
#contactos_botao {
width: 35px;
height: 52px;
position: absolute;
top: 85px;
left: 150px;
}
#contactos_texto {
width: 138px;
height: 28px;
position: absolute;
top: 100px;
left: 0px;
}
</style>
<script language="JavaScript1.2">
function high(which2)
{
theobject=which2
highlighting=setInterval("highlightit(theobject)",20)
}
function low(which2)
{
clearInterval(highlighting)
which2.filters.alpha.opacity=0
}
function highlightit(cur2)
{
if (cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=17
else if (window.highlighting)
clearInterval(highlighting)
}
</script>
</head>
<body>
<!--
style="filter:alpha(opacity=50);-moz-opacity:1" onMouseover="high(this)" onMouseout="low(this)"
so the image would look like this:
<img src="image url" style="filter:alpha(opacity=0);-moz-opacity:1" onMouseover="high(this)" onMouseout="low(this)" border="0" width="600" height="380">
/-->
<div id="horizon">
<div id="container">
<div id="contactos_botao">
<img src="http://xorisso.home.sapo.pt/html/contactos_botao.gif" style="filter:alpha(opacity=0); -moz-opacity:1; border:2px;" onmouseover="high(this)" onmouseout="low(this)" />
</div>
<div id="contactos_texto">
<img src="http://xorisso.home.sapo.pt/html/contactos_text.gif" />
</div>
</div>
</div>
</body>
</html>