script.js
来自「lynda.com 2007年出品的javascript essential t」· JavaScript 代码 · 共 48 行
JS
48 行
window.onload = rolloverInit;function rolloverInit() { for (var i=0; i<document.images.length; i++) { if (document.images[i].parentNode.tagName == "A") { setupRollover(document.images[i]); } }}function setupRollover(thisImage) { thisImage.outImage = new Image(); thisImage.outImage.src = thisImage.src; thisImage.onmouseout = rollOut; thisImage.overImage = new Image(); thisImage.overImage.src = "images/" + thisImage.id + "_on.gif"; thisImage.onmouseover = rollOver; thisImage.clickImage = new Image(); thisImage.clickImage.src = "images/" + thisImage.id + "_click.gif"; thisImage.onmousedown = rollClick; thisImage.parentNode.childImg = thisImage; thisImage.parentNode.onblur = rollOutChild; thisImage.parentNode.onfocus = rollOverChild;}function rollOut() { this.src = this.outImage.src;}function rollOver() { this.src = this.overImage.src;}function rollClick() { this.src = this.clickImage.src;}function rollOutChild() { this.childImg.src = this.childImg.outImage.src;}function rollOverChild() { this.childImg.src = this.childImg.overImage.src;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?