<html>
<head>
<script language="javascript">
function doit(id, opacStart, opacEnd, millisec){
var id = id;
var opacStart = opacStart;
var opacEnd = opacEnd;
var millisec = millisec;
setTimeout("opacity();", 1000);
}
function opacity() {
//speed for each frame
var speed = Math.round(millisec / 100);
var timer = 0;
//determine the direction for the blending, if start and end are the same nothing happens
if(opacStart > opacEnd) {
for(i = opacStart; i >= opacEnd; i--) {
setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
timer++;
}
} else if(opacStart < opacEnd) {
for(i = opacStart; i <= opacEnd; i++)
{
setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
timer++;
}
}
}
//change the opacity for different browsers
function changeOpac(opacity, id) {
var object = document.getElementById(id).style;
object.opacity = (opacity / 100);
object.MozOpacity = (opacity / 100);
object.KhtmlOpacity = (opacity / 100);
object.filter = "alpha(opacity=" + opacity + ")";
}
</script>
</head>
<body>
<a href="#" onmouseover="javascript:doit('button1', 100, 0, 500)"
onmouseout="javascript:doit('button1', 0, 100, 500)">
<img src="button1.gif" id="button1" border="0">
</a>
</body>
</html>
anyone have a clue why my variables aren't getting passed and why this isn't working?
Last edited by coreymanshack on Sat Sep 23, 2006 6:19 am; edited 1 time in total
<head>
<script language="javascript">
function doit(id, opacStart, opacEnd, millisec){
var id = id;
var opacStart = opacStart;
var opacEnd = opacEnd;
var millisec = millisec;
setTimeout("opacity();", 1000);
}
function opacity() {
//speed for each frame
var speed = Math.round(millisec / 100);
var timer = 0;
//determine the direction for the blending, if start and end are the same nothing happens
if(opacStart > opacEnd) {
for(i = opacStart; i >= opacEnd; i--) {
setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
timer++;
}
} else if(opacStart < opacEnd) {
for(i = opacStart; i <= opacEnd; i++)
{
setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
timer++;
}
}
}
//change the opacity for different browsers
function changeOpac(opacity, id) {
var object = document.getElementById(id).style;
object.opacity = (opacity / 100);
object.MozOpacity = (opacity / 100);
object.KhtmlOpacity = (opacity / 100);
object.filter = "alpha(opacity=" + opacity + ")";
}
</script>
</head>
<body>
<a href="#" onmouseover="javascript:doit('button1', 100, 0, 500)"
onmouseout="javascript:doit('button1', 0, 100, 500)">
<img src="button1.gif" id="button1" border="0">
</a>
</body>
</html>
anyone have a clue why my variables aren't getting passed and why this isn't working?
Last edited by coreymanshack on Sat Sep 23, 2006 6:19 am; edited 1 time in total
