<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/htmlcharset=gb2312" />
<title>会变色的字</title>
</head>
<body>
<div ><b><a href = "" id = "ppp">会变色的字</a></b>
<a href = "" id = "pp">会变色的字</a>
<a href = "" id = "p">会变色的字</a>
<a href = "" id = "ppp">会变色的字</a>
</body><script>
var chars = ['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F']
function generateMixed(n) {
var res = ""
for(var i = 0i <n i ++) {
var id = Math.ceil(Math.random()*16)
res += chars[id]
}
return res
}
var num = generateMixed(6)
var p = document.getElementByIdx_x('ppp')
p.style.color = "#"+num
var p = document.getElementByIdx_x('pp')
p.style.color = "#"+num
var p = document.getElementByIdx_x('p')
p.style.color = "#"+num
</script>
</html>
<div id="rand"></div>var n=document.getElementById('rand')
n.style.background(rand(0,255),rand(0,255),rand(0,255))
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)