Solved

Using CSS to fade out things.

Posted on 2001-07-13
3
151 Views
Last Modified: 2012-08-13
Ok, I am trying to use CSS's alpha property to make a button fade out when I click another.  I need to use timeout, but don't understand it enough to make it work.  My code is:

<HEAD>
<SCRIPT>
blah=100
function fadeout() {
dimbutton.filters.item(0).enabled = 1
dimbutton.filters.item(0).opacity = blah
while (blah>1)
 {blah --
setTimeout("StepItDown()", (100-blah)*100)
 }
}
function StepItDown()
{
dimbutton.filters.item(0).opacity = blah
}

</SCRIPT>
</HEAD>



<INPUT type="button" value="Click me" id=dimbutton style="filter:Alpha(enabled=0)">


<INPUT type="button" style="position:absolute; top:40; left:220" value="Fade it out" onclick = "fadeout()" >


Now, it works, but it doesn't fade, it just executes the script and counts down 100 to 1, and THEN updates the screen... I know there's an easy was to fix this...
0
Comment
Question by:Radioman2024
  • 3
3 Comments
 
LVL 2

Accepted Solution

by:
tewald earned 50 total points
Comment Utility
Give this a try Radioman:

<html>
<head>
<script>
<!--
blah=5000
function fadeout() {
     dimbutton.filters.item(0).enabled = 1
     dimbutton.filters.item(0).opacity = blah
     for(blah = 5000; blah > 0; blah--) {
          dimbutton.filters.item(0).opacity = blah
     }
}
//->
</script>
</head>
<body>
<input type="button" value="Click Me" id=dimbutton style="filter:Alpha(enabled=0)"><br>
<input type="button" style="position:absolute; top:40; left:220" value="Fade It Out" onclick = "fadeout();">
</body>
</html>
0
 
LVL 2

Expert Comment

by:tewald
Comment Utility
Radioman, I think I missed your point with my last comment...  skip it.  However, I'm pretty sure you can't fade-out a button.
0
 
LVL 2

Expert Comment

by:tewald
Comment Utility
Thanks for the "A" Radioman.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now