In the HTML below I want a div containing a text and an image to fade in after a preset time (in this case 2 seconds). The fadingin works but a little bit later there comes an error. What do I do wrong?
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<meta name="generator" content="Adobe GoLive 4">
<title>Welcome to Adobe GoLive 4</title>
<script language="JavaScript"><!--
var isNS = document.layers?true:false;
var isIE = document.all?true:false;
var isDOM = document.getElementById?true:false;
function show(id)
{
if (isNS) document.layers[id].visibility = "show";
else if (isIE)
{
document.all[id].style.visibility="visible";
//de 100 geeft de doorzichtigheid aan.
setTimeout("doFadeIn('"+id+"',100)",1000);
}
else if (isDOM) document.getElementById(id).style.visibility="visible";
}
function hide(id)
{
if (isNS) document.layers[id].visibility = "hide";
else if (isIE)
{
// document.all[id].style.visibility="hidden";
setTimeout("doFadeOut('"+id+"',100)",1000)
}
else if (isDOM) document.getElementById(id).style.visibility="hidden";
}
function doFadeIn(fadeName,maxPct)
{
var fadeObj = document.all[fadeName]
if ((fadeObj.filters.alpha.opacity + 6) <= maxPct)
{
fadeObj.filters.alpha.opacity += 6;
setTimeout("doFadeIn('" + fadeObj.id + "'," + maxPct + ")",30)
}
else fadeObj.filters.alpha.opacity = maxPct;
}
function doFadeOut(fadeName,maxPct)
{
var fadeObj = document.all[fadeName]
if ((fadeObj.filters.alpha.opacity - 8) >= 0)
{
fadeObj.filters.alpha.opacity -= 8;
setTimeout("doFadeOut('" + fadeObj.id + "'," + maxPct + ")",30)
}
else fadeObj.filters.alpha.opacity = 0;
}
// -->
</script>
</head>
<body>
<div id="divtofade" style="visibility:hidden;">
Welcome
<img src='draaikolk.jpg' width="50" height="50" alt="">
</div>
<script language="javascript1.3">
<!--
setTimeout("show(\'divtofade\')",2000)
// -->
</script>
</body>
</html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<meta name="generator" content="Adobe GoLive 4">
<title>Welcome to Adobe GoLive 4</title>
<script language="JavaScript"><!--
var isNS = document.layers?true:false;
var isIE = document.all?true:false;
var isDOM = document.getElementById?true:false;
function show(id)
{
if (isNS) document.layers[id].visibility = "show";
else if (isIE)
{
document.all[id].style.visibility="visible";
//de 100 geeft de doorzichtigheid aan.
setTimeout("doFadeIn('"+id+"',100)",1000);
}
else if (isDOM) document.getElementById(id).style.visibility="visible";
}
function hide(id)
{
if (isNS) document.layers[id].visibility = "hide";
else if (isIE)
{
// document.all[id].style.visibility="hidden";
setTimeout("doFadeOut('"+id+"',100)",1000)
}
else if (isDOM) document.getElementById(id).style.visibility="hidden";
}
function doFadeIn(fadeName,maxPct)
{
var fadeObj = document.all[fadeName]
if ((fadeObj.filters.alpha.opacity + 6) <= maxPct)
{
fadeObj.filters.alpha.opacity += 6;
setTimeout("doFadeIn('" + fadeObj.id + "'," + maxPct + ")",30)
}
else fadeObj.filters.alpha.opacity = maxPct;
}
function doFadeOut(fadeName,maxPct)
{
var fadeObj = document.all[fadeName]
if ((fadeObj.filters.alpha.opacity - 8) >= 0)
{
fadeObj.filters.alpha.opacity -= 8;
setTimeout("doFadeOut('" + fadeObj.id + "'," + maxPct + ")",30)
}
else fadeObj.filters.alpha.opacity = 0;
}
// -->
</script>
</head>
<body>
<div id="divtofade" style="visibility:hidden;">
Welcome
<img src='draaikolk.jpg' width="50" height="50" alt="">
</div>
<script language="javascript1.3">
<!--
setTimeout("show(\'divtofade\')",2000)
// -->
</script>
</body>
</html>