可弹出的隐藏层(DHTML)
<SCRIPT language=JavaScript1.2>
if (document.layers) {n=1;ie=0}
if (document.all) {n=0;ie=1}
function init() {
if (n) tab = document.tabDiv
if (n) poptext = document.poptextDiv
if (ie) tab = tabDiv.style
if (ie) poptext = poptextDiv.style
}
var tabShow=1;
file://Hide-Show Layer
function hidepoptext() {
if (tabShow == 1) {
if (n) {
tab.visibility = "hide";
tab.left = 0;
tab.visibility = "show";
poptext.visibility = "hide";
tabShow = 0;
return;
}
if (ie) {
tab.visibility = "hidden";
tab.left = 0;
tab.visibility = "visible";
poptext.visibility = "hidden";
tabShow = 0;
return;
}
}
if (tabShow == 0) {
if (n) {
tab.visibility = "hide";
tab.left = 223;
tab.visibility = "show";
poptext.visibility = "show";
tabShow = 1;
}
if (ie) {
tab.visibility = "hidden";
tab.left = 223;
tab.visibility = "visible";
poptext.visibility = "visible";
tabShow = 1;
}
}
}
</SCRIPT>
<STYLE>#tabdiv {
LEFT: 223px; POSITION: absolute; TOP: 20px; Z-INDEX: 2
}
#poptextdiv {
BACKGROUND-COLOR: #eeeeff; BORDER-BOTTOM-COLOR: #000099; BORDER-BOTTOM-WIDTH: 2px; BORDER-LEFT-COLOR: #000099; BORDER-LEFT-WIDTH: 2px; BORDER-RIGHT-COLOR: #000099; BORDER-RIGHT-WIDTH: 2px; BORDER-TOP-COLOR: #000099; BORDER-TOP-WIDTH: 2px; COLOR: black; LEFT: 0px; PADDING-BOTTOM: 10px; PADDING-LEFT: 5px; PADDING-RIGHT: 5px; PADDING-TOP: 10px; POSITION: absolute; TOP: 10px; WIDTH: 223px; Z-INDEX: 1
}
#maintext {
LEFT: 240px; POSITION: absolute; TOP: 10px; WIDTH: 470px
}
</STYLE>
第二步:修改body语句为:
<body onload=init()>
第三步,将下列代码紧接着放在<body>语句后面
<DIV id=tabDiv><A href="javascript:hidepoptext();"><IMG alt="" border=0 src="tab.gif" width="15" height="164"> </A></DIV>
<DIV id=poptextDiv><p>这就是弹出式菜单。</p>
<p>这里可以改成你喜欢</p>
<p>的文字或者菜单,</p>
<p>用鼠标点击边上的箭头</p>
<p>可以弹出或隐藏该层</p>
<p>赶快下载教程试一试哦:)</p>
</DIV>
说明: 这个脚本适合IE和NC4.0以上版本。
其中的"tab.gif"可以替换为你自己的图片
变量tabShow=1或者tabShow=0决定一开始是否显示该层
浙公网安备 33010602011771号