<script type="text/javascript">
function Change(moren){
var objS= document.getElementById("bgid");
var col= objS.options[objS.selectedIndex].value;
if (col==""){
var col= moren;
}
if (col=="col1")
{objS.style.background = "green";}
if (col=="col2")
{objS.style.background = "red";}
}
</script>
亲测了一下:
<script type="text/javascript">
function Change(moren){
var objS= document.getElementById("bgid");
var col=""
if (moren){
col= moren;
}
else{
col= objS.options[objS.selectedIndex].value;
}
if (col=="col1")
{objS.style.background = "green";}
if (col=="col2")
{objS.style.background = "red";}
}