⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 14-9.htm

📁 JScript网页特效,包含很多的实现网页特效的方法.
💻 HTM
字号:
<html>
<head>
<title>§14.9 可左右滚动的菜单</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body bgcolor="#FFFFFF">
<style>
body{
overflow-x:hidden;
overflow-y:scroll;
}
</style>

<script language="JavaScript">

var menuwidth=300  //菜单宽度
var scrollspeed=6  //滚动速度
var menucontents='<nobr><a href="http://www.sina.com.cn">新浪网</a> | <a href="http://www.163.com">网 易</a> | <a href="http://www.coolbi.com">酷毙网</a> | <a href="http://www.sohu.com">搜 狐</a> | <a href="http://www.yesky.com/">天 极 网</a> | <a href="http://www.21cn.com">世纪网络</a> | <a href="http://www.easthome.net">东方网景</a> | <a href="http://www.163.net">163邮局</a></nobr>'
    //菜单内容
var actualwidth=''

function fillup()
{
  if (document.all)
  {
    test2.innerHTML=menucontents
    actualwidth=test2.offsetWidth
  }
}

function moveleft()
{
  if (document.all&&test2.style.pixelLeft>(menuwidth-actualwidth))
    test2.style.pixelLeft-=scrollspeed
  lefttime=setTimeout("moveleft()",50)
}

function moveright()
{
  if (document.all&&test2.style.pixelLeft<0)
    test2.style.pixelLeft+=scrollspeed
  righttime=setTimeout("moveright()",50)
}

if (document.all)
{
  with (document)
  {
    write('<table border="0" cellspacing="0" cellpadding="0">')
    write('<td valign="middle"><a href=#" onMouseover="moveleft()" onMouseout="clearTimeout(lefttime)"><<<</a> </td>')
    write('<td valign="top">')
    if (document.all)
    {
      write('<span style="position:relative;width:'+menuwidth+';">')
      write('<span style="position:absolute;width:'+menuwidth+';clip:rect(0 '+menuwidth+' auto 0)">')
      write('<span id="test2" style="position:absolute;left:0;top:0">')
      write('</span></span></span>')
    }
    write('</td>')
    write('<td valign="middle"> <a href="#" onMouseover="moveright()" onMouseout="clearTimeout(righttime)">')
    write('>>></a>')
    write('</td></table>')
  }
  window.onload=fillup
}
</script>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -