您好,欢迎访问一九零五行业门户网

2015.08.11-背景颜色切换函数_html/css_WEB-ITnose

简单的demo,点击切换背景颜色切换,附上代码。
.html文件
class='red' id=box>美美哒!...........

.css文件
.red{ width:100px; height:100px; background-color:red; border-radius:0 70px 0 60px ; transition-duration:1s;}.yellow{ width:150px; height:150px; border-radius:80px 0 100px 0; transition-duration:1s; background-color:yellow;}
.js文件
window.onload = function(){ var box = document.getelementbyid('box'); box.onclick = toyellow;};function tored(){ this.classname ='red'; this.onclick = toyellow;}function toyellow(){ this.classname ='yellow'; this.onclick = tored;}
其它类似信息

推荐信息