function prepareSlideshow() { if (!document.getElementsByTagName) return false; if (!document.getElementById) return false; if (!document.getElementById("linklist")) return false; var slideshow=document.createElement("div"); slideshow.setAttribute("id","slideshow"); var preview=document.createElement("img"); preview.setAttribute("src","images/topics.gif"); preview.setAttribute("alt","building blocks of web design"); preview.setAttribute("id","preview"); slideshow.appendChild(preview); var list=document.getElementById("linklist"); insertAfter(slideshow,list); var links=list.getElementsByTagName("a"); links[0].onmouseover=function(){ moveElement("preview",-100,0,10); } links[1].onmouseover=function(){ moveElement("preview",-200,0,10); } links[2].onmouseover=function(){ moveElement("preview",-300,0,10); } } addLoadEvent(prepareSlideshow);
已经平稳退化,把div里的属性元素,id元素全部放在了JavaScript里面,退化的更彻底。
时间: 2024-10-11 06:17:39