<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
function change() {
document.bgColor = "red";
}
</script></head>
<body><input type="text" name="color" id="color"/>
<input type="button" onclick="change(color)"/>
</body>
</html>怎么把第一个input的内容设置为可以输入颜色, 然后按button的时候实现改变背景颜色?
<head>
<title></title>
<script type="text/javascript">
function change() {
document.bgColor = "red";
}
</script></head>
<body><input type="text" name="color" id="color"/>
<input type="button" onclick="change(color)"/>
</body>
</html>怎么把第一个input的内容设置为可以输入颜色, 然后按button的时候实现改变背景颜色?
<html>
<head></head>
<body>
<input type="text" name="color" id="color"/>
<input type="button" onclick="change()" value="确定"/>
</body>
<script>
function change(){
var color_key=document.getElementById("color").value;
document.body.style.backgroundColor=color_key;
}
</script>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
function change() {
var color = document.getElementById("color").value;
document.bgColor = color;
}
</script></head>
<body><input type="text" name="color" id="color"/>
<input type="button" onclick="change()"/>
</body>
</html>