感谢您的支持,我会继续努力的!
打开微信扫一扫,即可进行扫码打赏哦
点我查看本站打赏源码!
Powered by RUNCODEX.COM,学的不仅是技术,更是梦想!!!
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>文档标题</title>
</head>
<body>
<h1 id="bsl">我的第一个HTML页面</h1>
<p>我的第一个段落。</p>
<button id="btn">
点我会变色
</button>
</body>
</html>
xxxxxxxxxx
window.onload=function(){
var arr=["#000","#00f","#0f0","#0ff","#f00","#f0f","#ff0","#fff"];
document.getElementById("btn").onclick=function(){
var index=Math.floor(Math.random()*7);
document.getElementById("bsl").style.background=arr[index];
}
输入 CSS 代码……