Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
Old 09-04-2009, 11:00 AM   #1 (permalink)
Junior Member
 
Join Date: 08-14-09
Posts: 4
iTrader: 0 / 0%
Latest Blog:
None

wtposs is liked by many
Fading text

I fund a nice code for text to appear and fade. But I'd like to trigger this with a button to only play one time. For example, my student will push "SHOW WORD" and the code below will kick in.

Any ideas how to do this? I'm not a programmer, but trying to learn. Thanks.

Here's the code i have:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>tyu</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> #wrap{ width:500px; padding:1px; border:3px double #99; font-family:arial,helvetica,serif; font-size:20pt; text-align:center; margin:30px auto;} #message{ height:1%; color:#930; filter:alpha(opacity=0); opacity:0;} </style> <script type="text/javascript"> /* Code Title: Dissolve Text Author: Raymond Angana Created: August 14, 2008 rangana in dynamicdrive.com/forums This notice must stay intact for legal use */ var txt=['EXAMPLE'], init=0,i=0,k=0,speed=20,el; var loopCount=1; var j=0; function fade(){ init==0?i++:i--; el.filters?el.style.filter='alpha(opacity='+i+')':el.style.opacity=i/100; el.firstChild.nodeValue=txt[k]; if(i==100)init=1; if(i==0) {init=0;k++;j++;} if(k==txt.length)k=0; if (j<loopCount) setTimeout('fade()',speed); } window.onload=function(){ el=document.getElementById('message'); fade(); } </script> </head> <body> <div id="wrap"> <div id="message">&nbsp;</div> </div> </body> </html>

Last edited by htmlbasictutor; 09-04-2009 at 05:26 PM..
wtposs is offline  
Add Post to del.icio.us
Reply With Quote
Old 09-04-2009, 08:17 PM   #2 (permalink)
Contributing Member
 
claire0917's Avatar
 
Join Date: 07-27-09
Posts: 110
iTrader: 0 / 0%
Latest Blog:
None

claire0917 is liked by many
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>tyu</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> #wrap{ width:500px; padding:1px; border:3px double #99; font-family:arial,helvetica,serif; font-size:20pt; text-align:center; margin:30px auto;} #message{ height:1%; color:#930; filter:alpha(opacity=0); opacity:0;} </style> <script type="text/javascript"> /* Code Title: Dissolve Text Author: Raymond Angana Created: August 14, 2008 rangana in dynamicdrive.com/forums This notice must stay intact for legal use */ var txt=['EXAMPLE'], init=0,i=0,k=0,speed=20,el; var loopCount=1; var j=0; function fade(){ init==0?i++:i--; el.filters?el.style.filter='alpha(opacity='+i+')':el.style.opacity=i/100; el.firstChild.nodeValue=txt[k]; if(i==100)init=1; if(i==0) { init=0; k++; j++; } if(k==txt.length)k=0; if (j<loopCount) setTimeout('fade()',speed); } function startFade() { el=document.getElementById('message'); fade(); } </script> </head> <body> <div id="wrap"> <div id="message">&nbsp;</div> <input type="button" value="Show" onclick="startFade();"> </div> </body> </html>

Last edited by htmlbasictutor; 09-04-2009 at 10:29 PM..
claire0917 is offline  
Add Post to del.icio.us
Reply With Quote
Old 09-05-2009, 07:07 AM   #3 (permalink)
Junior Member
 
Join Date: 08-14-09
Posts: 4
iTrader: 0 / 0%
Latest Blog:
None

wtposs is liked by many
Thanks Claire0917

I notice though that after the word fades out, if I click the "SHOW" button over and over, the word incrementally reappears. Is there a way to block that completely? This is part of a spelling quiz in which students see a word briefly and then re-type.
wtposs is offline  
Add Post to del.icio.us
Reply With Quote
Old 09-05-2009, 11:47 AM   #4 (permalink)
Member
 
Join Date: 09-05-09
Posts: 36
iTrader: 0 / 0%
Latest Blog:
None

Cabloo is liked by many
I'd suggest using jQuery and doing
$('#divIdoftext').stop().fadeTo(0, 400);
where 400 is the time in milliseconds.
Example: http://thecsports.com/
(site I'm doing PHP, HTML, and JS for atm.)
Click one of the links
Edit: The ones on thecsports.com fade in then out. You can view the source if you want to see.
Cabloo is offline  
Add Post to del.icio.us
Reply With Quote
Old 09-23-2009, 03:26 AM   #5 (permalink)
Junior Member
 
Join Date: 09-21-09
Posts: 10
iTrader: 0 / 0%
Latest Blog:
None

dweebsonduty is liked by many
I would have to agree about jquery it is soo much easier than regular javasctipt.

Check out the Jquery Cheat Sheet for more info.




[Removed]

Last edited by htmlbasictutor; 09-23-2009 at 09:57 AM..
dweebsonduty is offline  
Add Post to del.icio.us
Reply With Quote
Old 09-23-2009, 07:35 AM   #6 (permalink)
v7n Mentor
 
Tomassi's Avatar
 
Join Date: 01-26-06
Location: Amsterdam
Posts: 2,496
iTrader: 0 / 0%
Latest Blog:
None

Tomassi is a web professional of the highest orderTomassi is a web professional of the highest orderTomassi is a web professional of the highest orderTomassi is a web professional of the highest orderTomassi is a web professional of the highest orderTomassi is a web professional of the highest orderTomassi is a web professional of the highest orderTomassi is a web professional of the highest orderTomassi is a web professional of the highest orderTomassi is a web professional of the highest orderTomassi is a web professional of the highest order
Send a message via ICQ to Tomassi
Mootools is also a javascript library framework with similar functions such as JQuery. Also with graphical options.
__________________
I still got me a signature to fill
Tomassi is online now  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
••Text Ad Seller v2.0•• (INCREDIBLE) Sell Text Ads DIRECTLY through your site-INSTANT JackInTheBox Content 0 05-16-2009 05:46 PM
Commenting out parts of the body text to change the "First Sentence Text" for SEO? NameJunky Coding Forum 0 07-10-2008 09:18 PM
Pagerank 8 text link, buy text links, high pagerank links linkmaster SEO Forum 27 11-21-2006 01:23 PM
Wrapping text around a text box Grump Coding Forum 6 02-13-2005 09:59 PM
Fading Photos slide Show jolene Coding Forum 7 06-30-2004 05:46 AM


Sponsor Links
Get exposure! Contextual Links V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 11:58 AM.
© Copyright 2008 V7 Inc
Powered by vBulletin
Copyright © 2000-2009 Jelsoft Enterprises Limited.


Search Engine Optimization by vBSEO 3.3.0 ©2009, Crawlability, Inc.