新技术创造新生活!
[CODE]
<HTML>
<HEAD>
<TITLE> menu </TITLE>
</HEAD>
<BODY>
<SCRIPT LANGUAGE="vbScript">
Dim layerWidth,layerHeight,titleHeight,contentHeight,itemIndex
itemIndex=1
layerWidth=120 '层的高度
layerHeight=220 '层的宽度
titleHeight=20 '标题栏的高度
contentHeight=200 '内容区的高度
temp=20 '每次移动的高度
itemCount=4 '总菜单数
Function addLayer(titleText,contentText)
Dim innerHtml
'生成每一层
innerHtml="<div id='Item" & itemIndex &"' style='top:" & temp & ";overflow:hidden;position:absolute;border-style:solid;border-color:#FF99FF;width:" & layerWidth & ";height:" & layerHeight & ";border-width:1px'><table border='0' cellpadding='0' cellspacing='0'><tr><td onclick='vbscript:changeMove(" & itemIndex & ")' style='font-size:9pt;color:#FFFFFF;background-color:#008800;width:" & layerWidth & ";height:" & titleHeight-2 & ";cursor:hand'><center>" & titleText & "</center></td></tr><tr><td style='height:1px;background-color:#FFFFFF'></td></tr><tr><td style='font-size:9pt;background-color:#eeffee;height:" & layerHeight+2 & "'>" & contentText & "</td></tr></table></div>"
Document.write(innerHtml)
itemIndex=itemIndex+1
temp=temp+20
End function
addLayer "欢迎","<BR> 欢迎光临设计在线!"
addLayer "网页陶吧","<center><a href='#'>网页工具</a> <BR><BR><a href='#'>技术平台</a> <BR><BR><a href='#'>设计理念</a> <BR><BR><a href='#'>更多</a></center>"
addLayer "美工教室","<center><a href='#'>平面设计 </a> <BR><BR><a href='#'>三维空间</a> <BR><BR><a href='#'>设计基础</a> <BR><BR><a href='#'>更多..</a></center>"
addLayer "Flash","<center><a href='#'>基础教程</a> <BR><BR><a href='#'>技巧运用</a> <BR><BR><a href='#'>实例剖析</a> <BR><BR><a href='#'>更多..</a></center>"'使层向下移动
Function moveDown(currentItem)
Dim i
For i=currentItem To itemCount
If Document.getElementById("Item" & i).style.height<>"20px" And i<>1 then
Document.getElementById("Item" & i).style.top=CInt(Replace(Document.getElementById("Item" & i).style.top,"px",""))+contentHeight
Document.getElementById("Item" & i).style.height="20px"
End if
next
End Function'使层向上移动
Function moveUp(currentItem)
Dim i
For i=currentItem To 1 Step -1
If Document.getElementById("Item" & i).style.height<>"220px" then
Document.getElementById("Item" & i).style.top=CInt(Replace(Document.getElementById("Item" & i).style.top,"px",""))-contentHeight
Document.getElementById("Item" & i).style.height=layerheight
End if
next
End Function
Function changeMove(currentItem)
'MsgBox Document.getElementById("Item" & currentItem).style.height
If Document.getElementById("Item" & currentItem).style.height="220px" Then
moveDown(currentItem)
Else
moveUp(currentItem)
End If
End Function
moveDown(1)</SCRIPT>
</BODY>
</HTML>
[/CODE]
[此贴子已经被作者于2007-6-21 12:06:04编辑过]