<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<script type="text/javascript">
function change(){
var bgColor=document.getElementById("txtId").value;//获取输入的颜色值
var _body=document.getElementsByTagName("body");//获取页面属性
_body[0].style.backgroundColor=bgColor;
}
</script>
</style>
<body>

修改背景色: <input type="text" />

</body>
</html>

相关文章: