</SCRIPT>
</head>
<body>
<DIV ID=”mydiv” STYLE=” background-color: indigo;
height:400px; width:500px;
filter:progid:DXImageTransform.Microsoft.Fade
(duration=3);”>
</DIV>
<br>
<button onclick=”fader()”>Click Me!</button>
</body>
</html>
For those who prefer C and Java, here’s the JavaScript version of the same
function:
<SCRIPT>
var toggle = 0;
function fader() {
mydiv.filters[0].Apply();
if (toggle) {
toggle = 0;
mydiv.style.backgroundColor=”indigo”;}
else {
toggle = 1;
mydiv.style.backgroundColor=”lime”;}
mydiv.filters[0].Play();
}
</SCRIPT>
Microsoft has long promoted VBScript, but someone decided to make
JavaScript the default scripting language for Internet Explorer. Therefore, you
need not specify JavaScript in your code, as in <SCRIPT Language=Java
Script>. You can just use