155、隐藏在左侧的下拉菜单

155、隐藏在左侧的下拉菜单

脚本说明:

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

<style>

<!--

 

#slidemenubar, #slidemenubar2{

cursor:hand;

position:absolute;

left:-155px;

width:160px;

top:170px;

border:1.5px solid green;

background-color:lightyellow;

layer-background-color:lightyellow;

font:bold 12px Verdana;

line-height:20px;

}

-->

</style>

</head>

 

<body>

<script language="JavaScript1.2">

 

/*

Sliding Menu Bar Script-

? Dynamic Drive (www.dynamicdrive.com)

For full source code, installation instructions,

100's more DHTML scripts, and Terms Of

Use, visit dynamicdrive.com

*/

 

if (document.all)

document.write('<div id="slidemenubar2" style="left:-150">')

</script>

<layer id="slidemenubar">

<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/caidan/caidan.htm"

sitemlinks[5]="http://www.7stk.com/1/index06.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

}

var dragapproved=false

var x1,x2

if (document.layers)

themenu.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)

 

function move(e){

if (document.all&&event.button==1&&dragapproved){

if(temp1+event.clientX-x1>leftboundary)

themenu.pixelLeft=Math.min(rightboundary,temp1+event.clientX-x1)

else

themenu.pixelLeft=Math.max(leftboundary,temp1+event.clientX-x1)

}

 

 

else if (document.layers){

if(themenu.left+e.x-x2>leftboundary)

themenu.left=Math.min(rightboundary+2,themenu.left+e.x-x2)

else

themenu.left=Math.max(leftboundary-2,themenu.left+e.x-x2)

}

}

 

function drags(e){

if (document.all){

dragapproved=true

temp1=themenu.pixelLeft

x1=event.clientX

document.onmousemove=move

}

else{

themenu.captureEvents(Event.MOUSEMOVE)

x2=e.x

}

}

 

function stopit(){

if (document.all){

dragapproved=false

}

if (document.layers)

themenu.releaseEvents(Event.MOUSEMOVE)

}

 

if (document.all){

document.all.slidemenubar2.onmousedown=drags

document.all.slidemenubar2.onmouseup=new Function("dragapproved=false")

document.onselectstart=new Function("return false")

}

else if (document.layers){

themenu.onmousedown=drags

themenu.onmousemove=move

themenu.onmouseup=stopit

}

 

</script>

 

Write a comment

Comments: 0