蛙 27-5-2013 11:01
指向連結文字自動變色
<P><FONT color=purple>var rate = 50 <<< 50 是轉色速度,越大越快,可更改</FONT></P>
<P><FONT color=purple></FONT> </P><FONT color=purple>
<P><FONT color=#0000ff size=3>如不能顯示語法效果可貼去本站</FONT><A href="http://www.bunbun000.com/html/index.htm" target=_blank><FONT color=red size=3>語法測試板</FONT></A><FONT color=#0000ff size=3>試看</FONT></P>
<P><BR></P></FONT><FONT color=blue></FONT>
<P><FONT color=blue></FONT> </P>
<P><FONT color=blue></FONT> </P>
<P><FONT color=blue><script language=JavaScript><BR><!--<BR>var rate = 50;<BR>var obj;<BR>var act = 0;<BR>var elmH = 0;<BR>var elmS = 150;<BR>var elmV = 255;<BR>var clrOrg;<BR>var TimerID;<BR>if (navigator.appName.indexOf("Microsoft",0) != -1 && parseInt(navigator.appVersion) >= 4) {<BR> Browser = true;<BR>} else {<BR> Browser = false;<BR>}<BR>if (Browser) {<BR> document.onmouseover = doRainbowAnchor;<BR> document.onmouseout = stopRainbowAnchor;<BR>}<BR>function doRainbow()<BR>{<BR> if (Browser && act != 1) {<BR> act = 1;<BR> obj = event.srcElement;<BR> clrOrg = obj.style.color;<BR> TimerID = setInterval("ChangeColor()",100);<BR> }<BR>}<BR>function stopRainbow()<BR>{<BR> if (Browser && act != 0) {<BR> obj.style.color = clrOrg;<BR> clearInterval(TimerID);<BR> act = 0;<BR> }<BR>}<BR>function doRainbowAnchor()<BR>{<BR> if (Browser && act != 1) {<BR> obj = event.srcElement;<BR> <BR> while (obj.tagName != 'A' && obj.tagName != 'BODY') {<BR> obj = obj.parentElement;<BR> if (obj.tagName == 'A' || obj.tagName == 'BODY')<BR> break;<BR> }<BR> <BR> if (obj.tagName == 'A' && obj.href != '') {<BR> act = 1;<BR> clrOrg = obj.style.color;<BR> TimerID = setInterval("ChangeColor()",100);<BR> }<BR> }<BR>}<BR>function stopRainbowAnchor()<BR>{<BR> if (Browser && act != 0) {<BR> if (obj.tagName == 'A') {<BR> obj.style.color = clrOrg;<BR> clearInterval(TimerID);<BR> act = 0;<BR> }<BR> }<BR>}<BR>function ChangeColor()<BR>{<BR> obj.style.color = makeColor();<BR>}<BR>function makeColor()<BR>{<BR> if (elmS == 0) {<BR> elmR = elmV; elmG = elmV; elmB = elmV;<BR> }<BR> else {<BR> t1 = elmV;<BR> t2 = (255 - elmS) * elmV / 255;<BR> t3 = elmH % 60;<BR> t3 = (t1 - t2) * t3 / 60;<BR> <BR> if (elmH < 60) {<BR> elmR = t1; elmB = t2; elmG = t2 + t3;<BR> }<BR> else if (elmH < 120) {<BR> elmG = t1; elmB = t2; elmR = t1 - t3;<BR> }<BR> else if (elmH < 180) {<BR> elmG = t1; elmR = t2; elmB = t2 + t3;<BR> }<BR> else if (elmH < 240) {<BR> elmB = t1; elmR = t2; elmG = t1 - t3;<BR> }<BR> else if (elmH < 300) {<BR> elmB = t1; elmG = t2; elmR = t2 + t3;<BR> }<BR> else if (elmH < 360) {<BR> elmR = t1; elmG = t2; elmB = t1 - t3;<BR> }<BR> else {<BR> elmR = 0; elmG = 0; elmB = 0;<BR> }<BR> }<BR> elmR = Math.floor(elmR);<BR> elmG = Math.floor(elmG);<BR> elmB = Math.floor(elmB);<BR> clrRGB = '#' + elmR.toString(16) + elmG.toString(16) + elmB.toString(16);<BR> elmH = elmH + rate;<BR> if (elmH >= 360)<BR> elmH = 0;<BR> return clrRGB;<BR>}<BR>--><BR></script><BR></P></FONT>
蛙 27-5-2013 11:03
複製上列語法
<form name="copy">
<textarea cols="40" name="txt" rows="4" style="BACKGROUND-COLOR:#ffffff; COLOR:#000000; FONT-SIZE:9pt">
<script language=JavaScript>
<!--
var rate = 50;
var obj;
var act = 0;
var elmH = 0;
var elmS = 150;
var elmV = 255;
var clrOrg;
var TimerID;
if (navigator.appName.indexOf("Microsoft",0) != -1 && parseInt(navigator.appVersion) >= 4) {
Browser = true;
} else {
Browser = false;
}
if (Browser) {
document.onmouseover = doRainbowAnchor;
document.onmouseout = stopRainbowAnchor;
}
function doRainbow()
{
if (Browser && act != 1) {
act = 1;
obj = event.srcElement;
clrOrg = obj.style.color;
TimerID = setInterval("ChangeColor()",100);
}
}
function stopRainbow()
{
if (Browser && act != 0) {
obj.style.color = clrOrg;
clearInterval(TimerID);
act = 0;
}
}
function doRainbowAnchor()
{
if (Browser && act != 1) {
obj = event.srcElement;
while (obj.tagName != 'A' && obj.tagName != 'BODY') {
obj = obj.parentElement;
if (obj.tagName == 'A' || obj.tagName == 'BODY')
break;
}
if (obj.tagName == 'A' && obj.href != '') {
act = 1;
clrOrg = obj.style.color;
TimerID = setInterval("ChangeColor()",100);
}
}
}
function stopRainbowAnchor()
{
if (Browser && act != 0) {
if (obj.tagName == 'A') {
obj.style.color = clrOrg;
clearInterval(TimerID);
act = 0;
}
}
}
function ChangeColor()
{
obj.style.color = makeColor();
}
function makeColor()
{
if (elmS == 0) {
elmR = elmV; elmG = elmV; elmB = elmV;
}
else {
t1 = elmV;
t2 = (255 - elmS) * elmV / 255;
t3 = elmH % 60;
t3 = (t1 - t2) * t3 / 60;
if (elmH < 60) {
elmR = t1; elmB = t2; elmG = t2 + t3;
}
else if (elmH < 120) {
elmG = t1; elmB = t2; elmR = t1 - t3;
}
else if (elmH < 180) {
elmG = t1; elmR = t2; elmB = t2 + t3;
}
else if (elmH < 240) {
elmB = t1; elmR = t2; elmG = t1 - t3;
}
else if (elmH < 300) {
elmB = t1; elmG = t2; elmR = t2 + t3;
}
else if (elmH < 360) {
elmR = t1; elmG = t2; elmB = t1 - t3;
}
else {
elmR = 0; elmG = 0; elmB = 0;
}
}
elmR = Math.floor(elmR);
elmG = Math.floor(elmG);
elmB = Math.floor(elmB);
clrRGB = '#' + elmR.toString(16) + elmG.toString(16) + elmB.toString(16);
elmH = elmH + rate;
if (elmH >= 360)
elmH = 0;
return clrRGB;
}
-->
</script>
</textarea><br>
<input onclick="javascript:this.form.txt.focus();this.form.txt.select();" type="button" value="全選">
</form>
<br>
<script type="text/javascript"><!--
google_ad_client = "ca-pub-4078143172638881";
/* 336X280 */
google_ad_slot = "3268225205";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>