167、热键显示隐藏菜单

167、热键显示隐藏菜单

脚本说明:

把如下代码加入<body>区域中

<style>

<!--

 

#slidemenubar, #slidemenubar2{

position:absolute;

left:-165px;

width:90px;

top:170px;

border:1.5px solid green;

background-color:lightyellow;

layer-background-color:lightyellow;

font:bold 12px Verdana;

line-height:20px;

}

-->

</style>

<script language="JavaScript1.2">

 

function showtip(nulling){

if (document.all){

if (nulling==0&&slidemenubar2.style.pixelLeft==-150)

slidemenubar2.title=' "x" 显示菜单, "z" 隐藏菜单'

else

slidemenubar2.title=''

}

else if (document.layers){

if (nulling==0&&!window.pullit)

window.status=' "x" 显示菜单, "z" 隐藏菜单'

else

window.status=''

}

}

if (document.all)

document.write('<div id="slidemenubar2" style="left:-150" onMouseover="showtip(0)" onMouseout="showtip(1)">')

</script>

<layer id="slidemenubar" onMouseover="showtip(0)" onMouseout="showtip(1)">

<script language="JavaScript1.2">

var sitems=new Array()

var sitemlinks=new Array()

 

//extend or shorten this list

sitems[0]="新浪网"

sitems[1]="网易"

sitems[2]="搜狐"

sitems[3]="雅虎"

sitems[4]="音乐电台代码"

sitems[5]="精彩网页分享"

sitems[6]="网页特效代码"

 

 

 

//These are the links pertaining to the above text.

sitemlinks[0]="http://www.sina.com.cn"

sitemlinks[1]="http://www.163.com"

sitemlinks[2]="http://www.sohu.com"

sitemlinks[3]="http://www.yahoo.com"

sitemlinks[4]="http://www.7stk.com/radio/radio.htm"

sitemlinks[5]="http://www.7stk.com/fine/index.htm"

sitemlinks[6]="http://www.7stk.com/"

 

for (i=0;i<=sitems.length-1;i++)

document.write('<a href='+sitemlinks[i]+'>'+sitems[i]+'</a><br>')

</script>

</layer>

<script language="JavaScript1.2">

 

function regenerate(){

window.location.reload()

}

function regenerate2(){

if (document.layers)

setTimeout("window.onresize=regenerate",400)

}

window.onload=regenerate2

if (document.all){

document.write('</div>')

themenu=document.all.slidemenubar2.style

rightboundary=0

leftboundary=-150

}

else{

themenu=document.layers.slidemenubar

rightboundary=150

leftboundary=10

}

function pull(){

if (window.drawit)

clearInterval(drawit)

pullit=setInterval("pullengine()",50)

}

function draw(){

clearInterval(pullit)

drawit=setInterval("drawengine()",50)

}

function pullengine(){

if (document.all&&themenu.pixelLeft<rightboundary)

themenu.pixelLeft+=5

else if(document.layers&&themenu.left<rightboundary)

themenu.left+=5

else if (window.pullit)

clearInterval(pullit)

}

function drawengine(){

if (document.all&&themenu.pixelLeft>leftboundary)

themenu.pixelLeft-=5

else if(document.layers&&themenu.left>leftboundary)

themenu.left-=5

else if (window.drawit)

clearInterval(drawit)

}

 

if (document.layers)

document.captureEvents(Event.KEYPRESS)

function menuengine(e){

if (document.layers){

if (e.which==120)

pull()

if (e.which==122)

draw()

}

else if (document.all){

if (event.keyCode==120)

pull()

if (event.keyCode==122)

draw()

}

}

document.onkeypress=menuengine

</script>

 

Write a comment

Comments: 0