'filter' Example : filter « CSS Attributes and Javascript Style Properties « HTML CSS Reference






'filter' Example

    
<html>
<head>
<script language="JavaScript">
function function1(elem) {
   elem.style.filter="blendTrans(duration=1)";
   elem.filters.blendTrans.Apply();
   elem.style.visibility="hidden";
   elem.filters.blendTrans.Play();
   elem.filters.percent=20; 
}
function function2(elem) {
   elem.style.filter="blendTrans(duration=1)";
   elem.filters.blendTrans.Apply();
   elem.style.visibility="visible";
   elem.filters.blendTrans.Play();
   elem.filters.percent=80; 
} 
</script>
</head>
<body>
<img id="myImg" src="http://www.java2s.com/style/logo.png">
   <button onclick="function1(myImg)">Cause the image to fade out</button>
   <button onclick="function2(myImg)">Cause the image to fade in</button>
</body>
</html>

    
      
      








Related examples in the same category

1.'filter' Syntax and Note
2.'filter' is applied to