解讀 M$ 原始碼:JavaScript + CSS 實現動態菜單顯示
來源:互聯網
上載者:User
<!--解讀 M$ 原始碼:JavaScript + CSS 實現動態菜單顯示-->
<!--Default.htm-->
<!--小弟的 JavaScript 水平實在有夠差勁,故以下註解均為個人理解,有疏漏及不當之處還請各位大蝦指正-->
<!--以下原始碼來源於 M$ Windows 2000 Professional 安裝光碟片的 DISCOVER/EASY2USE 目錄,更改之處見文檔的最後註解-->
<!--有關“單位”與“集合”的定義,請參見文檔後面的註解-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<TITLE>更易使用</TITLE><!--注1-->
<SCRIPT language="javascript">
var whichIm;
var varColor = "DDEEFF";
document.onmouseover = mouseOver;
document.onmouseout = mouseOut;
document.onmousedown = mouseDown;
document.onmouseup = mouseUp;
function mouseOver() {
var vSrc = window.event.srcElement;
if (vSrc.className == "child2" || vSrc.className == "child3" || vSrc.className == "parent")/*判斷對象是否為“單位”*/ {
fColor = vSrc.style.backgroundColor;
vSrc.style.backgroundColor = varColor;
/*注2*/
}
}
function mouseOut() {
var vSrc = window.event.srcElement;
if (vSrc.className == "child2" || vSrc.className == "child3" || vSrc.className == "parent") {
vSrc.style.backgroundColor = fColor;
/*注2*/
}
}
function mouseDown() {
var vSrc = window.event.srcElement;
divColl=document.all.tags("DIV");