精彩的变色文字

王朝other·作者佚名  2006-11-24
窄屏简体版  字體: |||超大  

有什么问题请到<a href='/bbs/forums.php?fid=21'>论坛</a>中发表<br>

<!-- http://www.webjx.com -->

<!-- bbs http://www.webjx.com/bbs-->

<!--第一步:把如下代码加入<head>区域中-->

<!--把如下代码加入<body>区域中-->

<script language="JavaScript">

hexa = new MakeArray(16)

hexa[10] = "A"

hexa[11] = "B"

hexa[12] = "C"

hexa[13] = "D"

hexa[14] = "E"

hexa[15] = "F"

function MakeArray(n)

{

this.length = n

for (var i = 0; i <= n; i++)

this[i] = i

return this

}

function colours(text){

var posa = 0

var posb = 1

while (posa <= text.length){

var r = Math.floor(Math.random() * 15)

var rr= Math.floor(Math.random() * 15)

var g = Math.floor(Math.random() * 15)

var gg = Math.floor(Math.random() * 15)

var b = Math.floor(Math.random() * 15)

var bb = Math.floor(Math.random() * 15)

if (text.substring(posa,posb) == "<"){

var posaa = 0

posaa = posa

while (text.substring(posaa,posb) != ">"){

posaa++

posb++

}

document.write(text.substring(posa, posb))

posa = posb

posb = posa + 1

}

document.write("<font color=#"+hexa[r]+hexa[rr]+hexa[g]+hexa[gg]+hexa[b]+hexa[bb]+">")

document.write(text.substring(posa, posb)+"</font>")

posa++

posb++

}

}

</script>

<script language = "javascript">

text = "This JavaScript shows every other letter of text as a different, random colour."

text +="You can also use any <blink> <font size=9> HTML </font> </blink> codes that you want"

text +=" As long as you don't use quotation marks and the commands have a space between them."

text +=" You can use any background colour or picture that you want, but black or white is sugeste"

text +="d <b> <u>HAVE FUN!!! </u> </b>"

colours(text)

</script>

[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航