一,简单版

<body><header><imgsrc="img/2.jpg"alt=""><selectid="btn"><optionvalue="">请选择</option><option>背景春</option><option>背景夏</option><option>背景秋</option><option>背景冬</option></select><selectid="btn1"></select><h2><i>-春之情-主页导航</i></h2><span><ahref="#">换肤学习</a></span><imgsrc="img/2.jpg"alt=""><imgsrc="img/loading.gif"alt=""></header><divid="content"><imgsrc="img/bg1.jpg"alt="图片"></div><scriptsrc=script/jquery-1.11.3.js></script><script>//原生js实现functionchangeskin(imgurl){varimgobj=document.getElementsByTagName('img');imgobj[3].src=imgurl;}window.onload=function(){varbtnobj=document.getElementById("btn");varbtnobj1=document.getElementById("btn1");btnobj.addEventListener("change",function(){varindex=btnobj.selectedIndex;varimgurl=["","img/bg3.jpg","img/bg2.jpg","img/bg4.jpg","img/bg5.jpg"];//使用DOM方式新增选项varnewoption=document.createElement("option");newoption.appendChild(document.createTextNode("新增选项"));btnobj.appendChild(newoption);vartext=btnobj.options[index].text;//获得select选项中的文本值//使用selected属性设置为true,来选择选项if(btnobj.options[index].selected){changeskin(imgurl[index]);}//使用remove方法移除btnobj.remove(2);}</script></body>

实现效果图:

初始页面:

选择选项中的,背景冬:

背景换为:

总结:这是学习几个简单方法,做的简单小例子,在后期,还会继续完善,目标:

(1)使用jquery实现这个效果

(2)结合cookie实现页面定制效果。