首页 > 代码库 > 用JS让下拉框改变网页背景颜色

用JS让下拉框改变网页背景颜色

<HTML><HEAD><TITLE>石家庄渣浆泵配件</TITLE></HEAD><SCRIPT><!--function bgChange(selObj) {    newColor = selObj.options[selObj.selectedIndex].text;    document.bgColor = newColor;    selObj.selectedIndex = -1;    }//--></SCRIPT><BODY STYLE="font-family:Arial"><B>Changing Background Colors</B><BR> <FORM><SELECT SIZE="8" onChange="bgChange(this);">     <OPTION>Red     <OPTION>Orange     <OPTION>Yellow     <OPTION>Green     <OPTION>Blue     <OPTION>Indigo     <OPTION>Violet     <OPTION>White     </SELECT> </FORM><br /></BODY></HTML>