05. september 2002 - 12:58
Der er
3 kommentarer og 2 løsninger
tekst-fade?
Jeg vil gerne lave links der fader når musen kører hen over dem. Det kan ses på Chart.dk hvordan linkene fader fra mørk til lys når man kører musen over. Det er dette jeg leder efter. Det eneste er bare at på Chart.dk er det lavet med billeder. Er det ikke muligt at skrive et script så det bare er almindelig tekst der fader?
Annonceindlæg fra Cepheo
05. september 2002 - 13:05
#2
Sådan her : <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE>[Ingen titel]</TITLE> <SCRIPT TYPE="text/javascript"> i = 100; function fadeit(){ elementet.filters.alpha.opacity = i; i = i - 10; if (i > 35){ setTimeout("fadeit();",100); } else { elementet.filters.alpha.opacity = 25; elementet.style.display = ''; } } </SCRIPT> </HEAD> <BODY> <a href="#" onclick="fadeit()"> <div ID="elementet" style="filter:alpha(opacity=100, style=100);position:absolute;">Fade</div> </a> </BODY> </HTML> /Nikolaj
05. september 2002 - 13:07
#3
Her er Jakoba´s forslag :)) <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE>[Ingen titel]</TITLE> <META NAME="Generator" CONTENT="Stone's WebWriter 3"> <script type="text/javascript"> function debug( txt ) { document.frm.outp.value += txt; } var timeHandle = 0; function colArray( farve ) { var tmp = new Array(); if ( farve.charAt(0) == '#' ) { for ( i=0; 3>i; i++ ) tmp[i] = parseInt( farve.substr(1+2*i,2), 16 ); } else { farve = farve.substr(4); tmp = farve.split(","); for ( i=0; 3>i; i++ ) tmp[i] = parseInt( tmp[i], 10 ); } return tmp; }; //end colArray( string ) -> array function changeElem( fromFarve, tilFarve, tid, objS ) { this.fromColor = colArray( fromFarve ); this.toColor = colArray( tilFarve ); this.stepsIalt = Math.round( tid/50 ); this.step = 0; this.stil = objS; } var mr; function goStep( ) { var red = Math.round(mr.fromColor[0]+((mr.toColor[0]-mr.fromColor[0])*mr.step)/mr.stepsIalt); var green=Math.round(mr.fromColor[1]+((mr.toColor[1]-mr.fromColor[1])*mr.step)/mr.stepsIalt); var blue =Math.round(mr.fromColor[2]+((mr.toColor[2]-mr.fromColor[2])*mr.step)/mr.stepsIalt); var farve = (red*256 +green) *256 + blue; farve = "00000" +farve.toString(16); farve = "#" +farve.substr(farve.length-6); mr.stil.background = farve; mr.step += 1; if ( mr.stepsIalt >= mr.step ) { timeHandle = setTimeout( "goStep();", 50 ); } }; //end goStep( ) function skiftFarve( htmlObj, tilFarve, milliSecs ) { if ( ! htmlObj ) return; // sorry, no NS4.7 support clearTimeout( timeHandle ); mr = new changeElem( htmlObj.style.background, tilFarve, milliSecs, htmlObj.style ); goStep(); }; //end skiftFarve( html element, string, number ) function elm( idNavn ) { if ( document.getElementById ) { return document.getElementById( idNavn ); } else if ( document.all ) { return document.all[ idNavn ]; } return null; // sorry, no NS4.7 support }; //end elm( string ) -> html element </script> </HEAD> <BODY> <form name='frm'> <textarea name='outp' rows=10 cols=60 wrap='physical'></textarea> </form> <span id='elem' style="background:#ccFFFF;">en linie tekst</span> <p> <a href="" onclick="skiftFarve( elm('elem'), '#000000', 1500 );return false">#000000</a> | <a href="" onclick="skiftFarve( elm('elem'), '#ff0000', 1500 );return false">#ff0000</a> | <a href="" onclick="skiftFarve( elm('elem'), '#00ff00', 1500 );return false">#00ff00</a> | <a href="" onclick="skiftFarve( elm('elem'), '#0000ff', 1500 );return false">#0000ff</a> | <a href="" onclick="skiftFarve( elm('elem'), '#ff00ff', 1500 );return false">#ff00ff</a> | <a href="" onclick="skiftFarve( elm('elem'), '#00ffff', 1500 );return false">#00ffff</a> | <a href="" onclick="skiftFarve( elm('elem'), '#ffff00', 1500 );return false">#ffff00</a> | <a href="" onclick="skiftFarve( elm('elem'), '#ffffff', 1500 );return false">#ffffff</a></p> <!-- WebWriter AutoDato -->Opdateret: 29.7.2002<!-- WW --> </BODY> </HTML> /Nikolaj
05. september 2002 - 13:12
#4
PRØV AT TAKE HELE DETTE PÅ EN BLANK SIDE ---------------------------------------- <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <title>New Page 1</title> </head> <script> nereidFadeObjects = new Object(); nereidFadeTimers = new Object(); function nereidFade(object, destOp, rate, delta){ if (!document.all) return if (object != "[object]"){ //do this so I can take a string too setTimeout("nereidFade("+object+","+destOp+","+rate+","+delta+")",0); return; } clearTimeout(nereidFadeTimers[object.sourceIndex]); diff = destOp-object.filters.alpha.opacity; direction = 1; if (object.filters.alpha.opacity > destOp){ direction = -1; } delta=Math.min(direction*diff,delta); object.filters.alpha.opacity+=direction*delta; if (object.filters.alpha.opacity != destOp){ nereidFadeObjects[object.sourceIndex]=object; nereidFadeTimers[object.sourceIndex]=setTimeout("nereidFade(nereidFadeObjects["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate); } } </script> <body> <p><img border="0" src="Johnny%20side/chart.bmp" style="filter:alpha(opacity=10)" onmouseover="nereidFade(this,100,30,5)" onmouseout="nereidFade(this,10,50,5)" height="60" width="120"></p> </body> </html>