Have a look at the following code
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>DIV Opacity</title>
<style type="text/css">
#test{
zoom: 1;
width: 300px;
border:1px solid #000;
background-color: #c4c5c6;
padding: 5px;
}
</style>
<script type="text/javascript">
var testObj;
function changeOpacity(){
testObj = document.getElementById('test');
for(var i= 0; i <11; i++){
setTimeout('setOpacity('+i+')',100*i);
}
}
function setOpacity(value){
testObj.style.opacity = value/10;
testObj.style.filter = 'alpha(opacity=' + value * 10 + ')';
}
window.onload = function(){
document.getElementById('link').onclick = changeOpacity;
}
</script>
</head>
<body>
<p><a href="#" id="link">Test..</a></p>
<div id="test">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</div>
</body>
</html>
After loading the page in browser click the link 'Test..' and see how the fade-in operation performs on the div element placed just below the link. Then check the JS function setOpacity which changes the opacity of the DIV element.
I've used a function which you can find in the following location with a good account about the processing'
http://www.quirksmode.org/js/opacity.html
Hope this helps
Bookmarks