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

📄 day4_5.html

📁 成为真正的网页制作的高手的话,必须了解并使用DHTML.这里提供了最好的手册和文档.
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb_2312-80">
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<style type="text/css">
<!--
a:link {  color: blue; text-decoration: none}
a:visited {  color: purple; text-decoration: none}
a:hover {  color: purple; text-decoration: underline}
.unnamed1 {  font-family: "宋体"; font-size: 9pt}
-->
</style>
<style> 
<!--#menu {position: absolute;
left: 1px;top: 174px;width: 163px;height: 300px;}
-->
</style>
<style> 
<!--#content {position: absolute;
left: 175px;top: 184px;width: 435px;height: 300px;}
-->
</style>
<title>网猴:动态HTML</title>
</head>

<body bgcolor="#FFFFFF">
<div id="content" style="left: 11px; top: 15px; width: 464px; height: 1310px"> 
  <p> <font size="3"></font></p>
  <table border="0" width="441" cellspacing="0">
    <tr> 
      <td bgcolor="#ffff99" colspan="2"><font size="4" color="#000000"><strong>动态HTML教程 
        - 第四天</strong></font></td>
    </tr>
    <tr> 
      <td bgcolor="#FF6600" colspan="2"><em><font size="4"><a href="mailto:taylor@taylor.org">Taylor</a> 
        </font><font size="3">1998.3.9</font></em></td>
    </tr>
  </table>
  <p><strong><font face="宋体">第五页:使菜单具备相应的功能</font></strong></p>


<p><font size="3"><font face="宋体">下面要做的是给每个菜单条设定一个行为。你可以设定任何<br>
一种行为,不一定非得是动态HTML。但由于本教程讲的是动<br>
态HTML,而我们的课题是将如何改变layers的visibility<br>
(可视性)属性 。所以我们为每一个菜单项目设定隐藏和<br>
显示包含相应的网猴图象的层(layer)。 </font>

<ul>
  <pre><font face="宋体">&lt;script&gt;

function menuItem(item){

  if (document.layers) {

    daLast = document.layers[lastItem];

    daItem = document.layers[item];

  } else if (document.all) {

    daLast = document.all(lastItem).style;

    daItem = document.all(item).style;

  }

  daLast.visibility = hidden;

  daItem.visibility = visible;

  lastMenu.visibility = hidden;

  lastItem = item;

}



var lastItem = 'aaron';



&lt;/script&gt; </font></pre>
</ul>

<p><font face="宋体">这段脚本仍然用我们的老朋友--条件语句调用两个对象,<br>
现调用item,然后是最后被打开的lastitem(<tt>lastItem</tt>的缺<br>
省设置是<tt>'aaron'</tt> ),并且该语句还要记忆被打开的最后一<br>
个菜单(我们在barTog中设置的<tt>lastMenu</tt>)。设置完所<br>
有visibility后还记忆<tt>lastItem。</tt></font></p>

<p><font face="宋体">下面需要给每个菜单项目加上相应的anchor调用。</font> 

<ul>
  <pre><font face="宋体">&lt;a href=&quot;#&quot; class=&quot;itemAnchor&quot; 

onclick=&quot;menuItem('captCursor'); return false&quot;&gt;</font></pre>
</ul>

<p><font face="宋体">这条代码调用<tt>menuItem</tt>函数,并指示其显示ID为&quot;captCursor&quot;<br>
的DIV。现在将anchor锚定每个菜单项目并将每个DIV指向<br>
相应的网猴的名称。现在当你从菜单中选择相应的菜单时就<br>
会显示<a href="lessBasicMenu.htm">相应的网猴</a>。</font></p>

<p><font face="宋体">现在你可以制作你自己的菜单并在其中加入自己的菜单项<br>
目,隐藏及显示DIV,并在DIV中加入表单元素。明天的课程<br>
中我们将结合前面所学的知识作一个完整的展示。</font></p>
</font>

<p><font face="宋体"><strong>动态HTML教程</strong><br>
<font color="#FF0000">第一页</font> <a href="day4_1.html">让我们编写一些有用的东西</a><br>
<font color="#FF0000">第二页</font> <a href="day4_2.html">下拉菜单脚本</a><br>
<font color="#FF0000">第三页</font> <a href="day4_3.html">使菜单初具规模</a><br>
<font color="#FF0000">第四页</font> <a href="day4_4.html">完成菜单条的制作</a><br>
<font color="#FF0000">第五页</font> 使菜单具备相应的功能</font></p>

<p><font size="3">[<a href="day1_1.html">第1天</a>][<a href="day2_1.html">第2天</a>][<a href="day3_1.html">第3天</a>][第4天][<a href="day5_1.html">第5天</a>]</font></p>
  <font size="3"> 
  <hr>
  </font><font face="verdana, arial, geneva, sans-serif" size="2">本文由<a href="http://chd.126.com" target="_blank">《CHD的网络教室》</a>根据<a href="http://www.webmonkey.com.cn" target="_blank">《网猴》</a>相关文章改编,版权归<a href="http://www.webmonkey.com.cn" target="_blank">《网猴》</a>所有</font><font size="3"> 
  </font></div>
</body>
</html>

⌨️ 快捷键说明

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