页面代码:
<!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
>
< html xmlns ="http://www.w3.org/1999/xhtml" >
< head >
< meta http-equiv ="Content-Type" content ="text/html; charset=utf-8" />
< title >无标题文档 </ title >
< link rel ="stylesheet" href ="red.css" id ="lf" /></ link >
</ head >
< script >
function abc(obj)
{
var linkfile = document.getElementById( ' lf ' );
var c = obj.selectedIndex;
if (c == 1 ) linkfile.href = ' red.css ' ;
else if (c == 2 ) linkfile.href = ' green.css ' ;
else linkfile.href = ' yellow.css ' ;
}
</ script >
< body >
< div ></ div >
< select id ="selCss" onchange ="abc(this)" >
< option value ="0" >请选择颜色 </ option >
< option value ="1" >红色 </ option >
< option value ="2" >绿色 </ option >
< option value ="3" >黄色 </ option >
</ select >
</ body >
</ html >
< html xmlns ="http://www.w3.org/1999/xhtml" >
< head >
< meta http-equiv ="Content-Type" content ="text/html; charset=utf-8" />
< title >无标题文档 </ title >
< link rel ="stylesheet" href ="red.css" id ="lf" /></ link >
</ head >
< script >
function abc(obj)
{
var linkfile = document.getElementById( ' lf ' );
var c = obj.selectedIndex;
if (c == 1 ) linkfile.href = ' red.css ' ;
else if (c == 2 ) linkfile.href = ' green.css ' ;
else linkfile.href = ' yellow.css ' ;
}
</ script >
< body >
< div ></ div >
< select id ="selCss" onchange ="abc(this)" >
< option value ="0" >请选择颜色 </ option >
< option value ="1" >红色 </ option >
< option value ="2" >绿色 </ option >
< option value ="3" >黄色 </ option >
</ select >
</ body >
</ html >