猿问

代码无法实现

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<meta http-equiv="X-UA-Compatible" content="ie=edge">

<title>Document</title>

<script>

window.onload = open;

function open() {


var menu = document.getElementById("menu");

menu.onchange=function(){


var bgcolor = this.value;

if(bacolr=="")return;

document.body.style.background=bgcolor


}

}

</script>

</head>


<body>

<div class="box">

请选择背景颜色:

<select name="" id="=menu">

<option value="">请选择</option>

<option value="#foo">红色</option>

<option value="#ofo">绿色</option>

<option value="#oof">蓝色</option>

<option value="#ff0">黄色</option>

<option value="#ccc">灰色</option>

</select>


</div>


</body>


</html>


qq_胡思乱想_2
浏览 710回答 1
1回答
随时随地看视频慕课网APP
我要回答