Solved

Using CSS to fade out things.

Posted on 2001-07-13
3
152 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
ID: 6281802
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
ID: 6281816
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
ID: 6300531
Thanks for the "A" Radioman.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…

863 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

21 Experts available now in Live!

Get 1:1 Help Now