选项卡 tab切换

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<div>
<input type="button" value='red'>
<input type="button" value='green'>
<input type="button" value='blue'>
<input type="button" value='purple'>
<input type="button" value='pink'>
<div style='width:200px;height:200px;'></div>
</div>
<script>
/*
选项卡 tab切换
*/
var Chef = {
input:document.getElementsByTagName('input'),
div:document.getElementsByTagName('div')[1],
inputEvent:function(){
for(var i = 0;i<this.input.length;i++){
this.input[i].onclick = function(){
Chef.div.style.background = this.value;
}
}
}
}
Chef.inputEvent();
</script>
</body>
</html>
上一篇:Golang设计模式—简单工厂模式(Simple Factory Pattern)


下一篇:C#设计模式-1简单工厂模式Simple Factory)