⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 prepareslideshow.js

📁 《JavaScript DOM编程艺术》一书中的配套源代码
💻 JS
字号:
function prepareSlideshow() {// Make sure the browser understands the DOM methods  if (!document.getElementsByTagName) return false;  if (!document.getElementById) return false;// Make sure the elements exist  if (!document.getElementById("linklist")) return false;  var slideshow = document.createElement("div");  slideshow.setAttribute("id","slideshow");  var preview = document.createElement("img");  preview.setAttribute("src","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);// Get all the links in the list  var links = list.getElementsByTagName("a");// Attach the animation behavior to the mouseover event  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);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -