欢迎来到CClarence的博客!!

敲代码真的是一件令人感到上瘾的事情,在我二十多年的生活中,除了打DoTa,好像没有其他的另一件事也能让我如此乐此不疲。而前端恰恰是编程与界面的最前沿,它能让快速的让你感受到自己的成果,这是一件多么令人兴奋的事啊!!我希望在两年后我毕业的时候我能真的成为一位前端码农,在五年后我能成为一位NB的前端码农!!
----------CClarence写于2015年入冬。

001

prepareSlideshow函数

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里面,退化的更彻底。

posted @ 2015-10-27 12:12  CClarence  阅读(240)  评论(0)    收藏  举报