下例通过改变外嵌CSS样式文件即时改变网页样式:
在<head>....</head>之间放置以下内容:
<link href=" css/style01.css" rel="stylesheet" type="text/css" id="cssStyle" >
<script type="text/javascript">
function mm_changeStyle(file){
document.getElementById(" cssStyle").setAttribute("href",file);
}
</script>
以下内容置于<body>....</body>之间:
<img src="img/changeStylebt.gif" alt="" width="101" height="42" usemap="#Map" border="0"/>
<map name="Map" id="Map">
<area shape="rect" coords="39,15,50,27"
href="Javascript:mm_changeStyle(' css/style01.css');" />
<area shape="rect" coords="56,15,68,26"
href="Javascript:mm_changeStyle(' css/style02.css');" />
<area shape="rect" coords="73,15,84,27"
href="Javascript:mm_changeStyle(' css/style03.css');"/>
</map>