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"> </div>
</div>
</body>
</html>