I am working on a touch screen app. When user presses a key, key should fade slowly from black-yellow-black color. I could not get it work. Please someone help me. Thanks.
[CODE]
<html>
<head>
var inc = .01;
var delay =100;
function toggleImage(obj) {
obj.style.backgroundColor=”#FF0000″;
setTimeout(‘fadeOut(“‘+obj+'”,1-inc);’,delay);
setTimeout(‘fadeIn(“‘+obj+'”,0);’,delay);
obj.style.backgroundColor=”#FFFFFF”;
}
function fadeOut(obj,opacity) {
if (opacity > 0) {
obj.opacity = opacity;
// IE
obj.filter = “alpha(opacity=”+opacity*100+”)”;
setTimeout(‘fadeOut(“‘+obj+'”,”+opacity-inc+”);’,delay);
}
else {
obj.style.opacity = 0;
// IE
obj.style.filter = “alpha(opacity=0)”;
}
}
function fadeIn(obj,opacity) {
if (opacity < 1) {
obj.style.opacity = opacity;
obj.style.filter = “alpha(opacity=”+opacity*100+”)”;
setTimeout(‘fadeIn(“‘+obj+'”,”+opacity+inc+”);’,delay);
}
else {
obj.style.Opacity = .9999999;
// IE
obj.style.filter = “alpha(opacity=100)”;
}
}
</script>
</style>
</head>
<body>
<button onclick=”toggleImage(this);”>WEBDEVELOPER.COM</button>
</body>
</html>