Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

fade in and out with DHTML

Status
Not open for further replies.

korndogg

Programmer
Jun 26, 2000
22
BA
does anyone knows how to make an fade in /fade out effect with dhtml scripting?<br>ThAnKs
 
text fade or background color fade? <p>Liam Morley<br><a href=mailto:lmorley@wpi.edu>lmorley@wpi.edu</a><br><a href=] :: imotic :: website :: [</a><br>"light the deep, and bring silence to the world.<br>
light the world, and bring depth to the silence.
 
to be honest, i think you'll need a routine to do the background color changing. This means that you can only do it at the beginning of a page, not during.<br><br>Can't say i know the html/JS to do this, but it may help others to understand what you are trying to acomplish.<br><br>Karl.<br><br> <p> Karl<br><a href=mailto:mc_karl@yahoo.com>mc_karl@yahoo.com</a><br><a href= > </a><br> ~ ~ ~ ~<br>
K A R L<br>
~ ~ ~ ~
 
In IE there is a filter called alpha that you can apply to to a div, use that.<br><br><A HREF="mailto:jared@aauser.com">jared@aauser.com</A>
 
Dear korndogg,<br><br>This works in IE 4 and 5:<br><br>&lt;script language=javascript&gt;<br>&lt;!--<br>function fadeText(){<br><br>&nbsp;&nbsp;var sColor = document.all(&quot;fader&quot;).style.color.substr(1);<br>&nbsp;&nbsp;sColor = nextColor(sColor);<br>&nbsp;&nbsp;document.all(&quot;fader&quot;).style.color = sColor;<br>&nbsp;&nbsp;if ( sColor.indexOf(&quot;#ffffff&quot;) != 0)<br>&nbsp;&nbsp;&nbsp;&nbsp;setFadeTimer();<br>}<br><br>// takes a string and returns a string<br>function nextColor( sColor){<br><br>&nbsp;&nbsp;var sMask = &quot;&quot;;<br>&nbsp;&nbsp;for( i=0; i&lt;6; i++){<br>&nbsp;&nbsp;&nbsp;&nbsp;if ( sColor.charAt(i) == 'f')<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sMask += &quot;0&quot;;<br>&nbsp;&nbsp;&nbsp;&nbsp;else<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sMask += &quot;1&quot;;<br>&nbsp;&nbsp;}<br> <br>&nbsp;&nbsp;var nMask = parseInt(sMask,16);<br>&nbsp;&nbsp;var nVal = parseInt( sColor,16);<br>&nbsp;&nbsp;var nNext = nMask + nVal;<br>&nbsp;&nbsp;return &quot;#&quot; + nNext.toString(16);<br>}<br><br>function setFadeTimer(){<br>&nbsp;&nbsp;window.setTimeout(&quot;fadeText()&quot;, 200);<br>}<br>//--&gt;<br>&lt;/SCRIPT&gt;<br>&lt;BODY onload=&quot;setFadeTimer()&quot;&gt;<br>&lt;div id=&quot;fader&quot; style=&quot;color: #3f0033;&quot;&gt;Fading Text&lt;/div&gt;<br><br>I'll leave you to figure out the Nutscrap code.<br><br>Hope this helps<br>-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top