📄 14-4.htm
字号:
<html>
<head>
<title>§14.4 固定在窗口左边的菜单</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<SCRIPT language=JavaScript>
<!--
IE=document.all
NS=document.layers
hdrFontFamily="宋体"; //菜单标题栏字体
hdrFontSize="3"; //菜单标题栏字体大小
hdrFontColor="white"; //菜单标题栏字体颜色
hdrBGColor="#999999"; //菜单标题栏背景颜色
hdrTextAlign="Center"; //菜单标题栏位置属性
linkFontFamily="宋体"; //菜单内链接字体
linkFontSize="3"; //菜单内链接字体大小
linkBGColor="white"; //菜单内链接背景颜色
linkOverBGColor="#CCCCCC"; //当鼠标移上去后菜单内背景颜色
linkTextAlign="Center"; //菜单内链接字体位置左右属性
linkTarget="_top"; //点击菜单内链接后,文档加载的位置
YOffset=5; //菜单在窗口中的y位置
staticYOffset=20;
XOffset="5";
menuWidth="110"; //菜单的宽度
menuBGColor="black"; //菜单的边框颜色
menuIsStatic="yes"; //菜单是否一直保持在屏幕左边的固定位置
menuHeader="我的菜单"; //菜单名字
staticMode="smooth"; //菜单移动时的属性,smooth表示平滑,advanced表示直接移动
lastY = 0;
function makeStatic(mode)
{
if (IE) {winY = document.body.scrollTop;var NM=ssm3.style}
if (NS) {winY = window.pageYOffset;var NM=document.ssm3}
if (mode=="smooth")
{
if ((IE||NS) && winY!=lastY)
{
smooth = .2 * (winY - lastY);
if(smooth > 0) smooth = Math.ceil(smooth);
else smooth = Math.floor(smooth);
if (IE) NM.pixelTop+=smooth;
if (NS) NM.top+=smooth;
lastY = lastY+smooth;
}
setTimeout('makeStatic("smooth")', 1)
}
else
if (mode=="advanced")
{
if ((IE||NS) && winY>YOffset-staticYOffset)
{
if (IE) {NM.pixelTop=winY+staticYOffset}
if (NS) {NM.top=winY+staticYOffset}
}
else
{
if (IE) {NM.pixelTop=YOffset}
if (NS) {NM.top=YOffset-7}
}
setTimeout('makeStatic("advanced")', 1)
}
else {alert('Please choose either the "smooth" or "advanced" static modes!')}
}
//-->
</SCRIPT>
<SCRIPT language=JavaScript>
if (IE) {document.write('<DIV ALIGN="left" ID="ssm3" style="Position:Absolute;Left:'+XOffset+'px;Top:'+YOffset+'px;Z-Index:20;width:'+menuWidth+'px">')}
if (NS) {document.write('<LAYER top="'+YOffset+'" name="ssm3" left="'+XOffset+'"><TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 bgcolor="'+menuBGColor+'"><TR><TD>')}
document.write('<table border="0" cellpadding="0" cellspacing="1" bgcolor="'+menuBGColor+'"><TR><TD bgcolor="'+hdrBGColor+'" ALIGN="'+hdrTextAlign+'"><font face="'+hdrFontFamily+'" Size="'+hdrFontSize+'" COLOR="'+hdrFontColor+'"><b>'+menuHeader+'</b></font></td></tr><TR><TD><table border="0" cellpadding="0" cellspacing="0" width="'+menuWidth+'">')
function addItem(text, link, target) {
if (!target) {target=linkTarget}
document.write('<TR><TD BGCOLOR="'+linkBGColor+'" onmouseover="bgColor=\''+linkOverBGColor+'\'" onmouseout="bgColor=\''+linkBGColor+'\'"><ILAYER><LAYER onmouseover="bgColor=\''+linkOverBGColor+'\'" onmouseout="bgColor=\''+linkBGColor+'\'" WIDTH="100%" ALIGN="'+linkTextAlign+'"><P ALIGN="'+linkTextAlign+'"><FONT face="'+linkFontFamily+'" Size="'+linkFontSize+'"> <A HREF="'+link+'" target="'+target+'" CLASS="ssm3Items">'+text+'</A> </LAYER></ILAYER></TD></TR>')}
function addHdr(text) {
document.write('</table></td></tr><TR><TD bgcolor="'+hdrBGColor+'" ALIGN="'+hdrTextAlign+'"><font face="'+hdrFontFamily+'" Size="'+hdrFontSize+'" COLOR="'+hdrFontColor+'"><b>'+text+'</b></font></td></tr><TR><TD><table border="0" cellpadding="0" cellspacing="0" width="'+menuWidth+'">')}
//// Only edit between HERE
addItem('文本特效', 'http://javascript100.yeah.net', '');
addItem('窗口特效', 'http://javascript100.yeah.net', '');
addItem('按钮特效', 'http://javascript100.yeah.net', '');
addItem('密码特效', 'http://javascript100.yeah.net', '');
addItem('图像特效', 'http://javascript100.yeah.net', '');
addItem('鼠标特效', 'http://javascript100.yeah.net', '');
addItem('页面特效', 'http://javascript100.yeah.net', '');
addItem('背景特效', 'http://javascript100.yeah.net', '');
addHdr('联系方法');
addItem('给我写信', 'mailto:future3@yeah.net', '');
addItem('电话联系', 'http://javascript100.yeah.net', '');
addItem('OICQ', 'http://javascript100.yeah.net', '');
//// And HERE!
document.write('</table></TD></TR></table>')
if (IE) {document.write('</DIV>')}
if (NS) {document.write('</TD></TR></table></LAYER>')}
if ((IE||NS) && (menuIsStatic=="yes"&&staticMode)) {makeStatic(staticMode);}</SCRIPT>
</head>
<body bgcolor="#FFFFFF">
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -