富贵资源网 Design By www.hznty.com
复制代码 代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
body{
font-size:12px;
font-family:"Courier New", Courier, monospace;
letter-spacing:5px;
}
ul{
list-style:none;
}
li{
width:130px;
height:130px;
line-height:130px;
vertical-align:middle;
text-align:center;
float:left;
margin-left:20px;
}
</style>
<script src="/UploadFiles/2021-04-02/jquery-1.11.0.min.js"><title>javascript生成随机颜色</title>
<script type="text/javascript">
$(function(){
$("ul li").each(function(){
$(this).css("background-color",getRandomColor());
});
})
function getRandomColor()
{
var c = '#';
var cArray = ['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'];
for(var i = 0; i < 6;i++)
{
var cIndex = Math.round(Math.random()*15);
c += cArray[cIndex];
}
return c;
}

</script>
</head>

<body>
<div>
<ul>
<li>第一个色块</li>
<li>第二个色块</li>
<li>第三个色块</li>
<li>第四个色块</li>
</ul>
</div>
</body>
</html>
富贵资源网 Design By www.hznty.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
富贵资源网 Design By www.hznty.com