动态改变网页背景

2016-02-22    编辑:netuser     点击(

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>New document</title>
</head>
<body>
<div id="div1">
 <ul>
  <li>some text</li>
  <li>some text</li>
  <li>some text</li>
 </ul>
</div>
<select onchange="document.getElementById('div1').style.backgroundColor=this.value">
 <option value="#ffffff">选择背景颜色</option>
 <option value="#ff0000">红色</option>
 <option value="#00ff00">绿色</option>
 <option value="#0000ff">蓝色</option>
 <option value="#ffffff">白色</option>

</select>
</body>
</html>