返回 获取随机色外加...... 登陆

获取随机色外加按钮刷新和点击次数更迭

久伴 2019-02-19 23:29:08 309

获取随机色外加按钮刷新和点击次数更迭

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<title></title>

<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>

<style type="text/css">

a {

display: block;

width: 100px;

height: 100px;

border-radius: 50px;

text-align: center; 

line-height: 100px;

float: left;

text-decoration: none;

color: white;

margin-left: 20px;

}

</style>

<script type="text/javascript">

function abc(tag) {

var a = document.getElementsByTagName(tag).length;

for (var i = 0; i < a; i++) {

document.getElementsByTagName(tag)[i].style.backgroundColor = 'rgb('+Math.floor(Math.random()*256)+','+Math.floor(Math.random()* 256)+','+Math.floor(Math.random() * 256)+')'

num[i]=0

}

}

function aa(tag) {

var a = document.getElementsByTagName('a').length;

tag.innerHTML=parseInt(tag.innerHTML)+1

tag.style.backgroundColor='rgb('+Math.floor(Math.random()*256)+','+Math.floor(Math.random()* 256)+','+Math.floor(Math.random() * 256)+')'

}

$(document).ready(function() {

abc('a')

})

</script>

</head>

<body>

<a href="#" onclick="aa(this)">0</a>

<a href="#" onclick="aa(this)">0</a>

<a href="#" onclick="aa(this)">0</a>

<a href="#" onclick="aa(this)">0</a>

</body>

</html>

最新手记推荐

• 用composer安装thinkphp框架的步骤 • 省市区接口说明 • 用thinkphp,后台新增栏目 • 管理员添加编辑删除 • 管理员添加编辑删除

全部回复(0)我要回复

暂无评论~
  • 取消 回复 发送
  • PHP中文网