發新話題
打印

指向連結文字自動變色

指向連結文字自動變色

<P><FONT color=purple>var rate = 50  &lt;&lt;&lt;  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>&lt;script language=JavaScript&gt;<BR>&lt;!--<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) &gt;= 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 &lt; 60) {<BR>            elmR = t1;  elmB = t2;  elmG = t2 + t3;<BR>        }<BR>        else if (elmH &lt; 120) {<BR>            elmG = t1;  elmB = t2;  elmR = t1 - t3;<BR>        }<BR>        else if (elmH &lt; 180) {<BR>            elmG = t1;  elmR = t2;  elmB = t2 + t3;<BR>        }<BR>        else if (elmH &lt; 240) {<BR>            elmB = t1;  elmR = t2;  elmG = t1 - t3;<BR>        }<BR>        else if (elmH &lt; 300) {<BR>            elmB = t1;  elmG = t2;  elmR = t2 + t3;<BR>        }<BR>        else if (elmH &lt; 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 &gt;= 360)<BR>        elmH = 0;<BR>    return clrRGB;<BR>}<BR>--&gt;<BR>&lt;/script&gt;<BR></P></FONT>
我唔係人.........

TOP

複製上列語法



我唔係人.........

TOP