Quick Search:
CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
 JavaScript: Javascript "Fade In On Click" Jump to:  
Category: >> JavaScript >> Javascript "Fade In On Click" Bookmark and Share

<< lastnext >>

Snippet Name: Javascript "Fade In On Click"

Description: Fade in any element (text, image, controls, etc) on a click event. Uses a smooth browser-safe opacity handling function.

Comment: (none)

Language: JAVASCRIPT
Highlight Mode: JAVASCRIPT
Last Modified: February 27th, 2009

<html>
<head>
</head>
<body>
 
<script type='text/javascript'>
 
// Browser safe opacity handling function
 
FUNCTION setOpacity( value ) {
 document.getElementById("styled_popup").style.opacity = value / 10;
 document.getElementById("styled_popup").style.filter = 'alpha(opacity=' + value * 10 + ')';
}
 
FUNCTION fadeInMyPopup() {
 FOR( VAR i = 0 ; i <= 100 ; i++ )
   setTimeout( 'setOpacity(' + (i / 10) + ')' , 8 * i );
}
 
FUNCTION fadeOutMyPopup() {
 FOR( VAR i = 0 ; i <= 100 ; i++ ) {
   setTimeout( 'setOpacity(' + (10 - i / 10) + ')' , 8 * i );
 }
 
 setTimeout('closeMyPopup()', 800 );
}
 
FUNCTION closeMyPopup() {
 document.getElementById("styled_popup").style.visibility = "hidden"
}
 
FUNCTION fireMyPopup() {
 setOpacity( 0 );
 document.getElementById("styled_popup").style.visibility = "visible";
 fadeInMyPopup();
}
</script>
 
 
<p>
 
<table id='styled_popup' NAME='styled_popup' style='width: 380px; height: 200px; visibility:hidden; zoom: 1' bgcolor="#ffffdd" cellpadding='0' cellspacing='0' border='0'>
<tr><td style='width: 380px; height: 200px;'>
Hey, look at me!<br>
I'm fading :-)
</td></tr>
</table>
 
<input type='submit' onClick='fireMyPopup()' value=' Fire! '>
 
</body>
</html>
 
 
 


Free
Oracle Magazine
Subscriptions
and Oracle White Papers


SQL University.net courses meet the most demanding needs of the business world for advanced education in a cost-effective manner. SQL University.net courses are available immediately for IT professionals and can be taken without disruption of your workplace schedule or processes.

Compared to traditional travel-based training, SQL University.net saves time and valuable corporate resources, allowing companies to do more with less. That's our mission, and that's what we deliver.

Click here to find out more
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 80 users online    © 2009 psoug.org

PSOUG LOGIN
Username: 
Password: 
Forgot your password?