我想点一个按扭出现一个层,再点一下层消失,就像Windwos里开始菜单的那种效果,怎么办,帮一下

解决方案 »

  1.   

    思路:1、首先定义一个层<div>
    2、然后通过onclick时间更改<div>标记的样式属性display 来隐藏和显示这个<DIV>之间的内容代码写起烦琐,我没有现成的,看看楼下有没有人给你贴上来。
      

  2.   

    给层设置一个id,点鼠标执行js函数,此函数控制层的display属性
      

  3.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">
    <head>
    <title> New Document </title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <meta name="Generator" content="EditPlus" />
    <meta name="Author" content="" />
    <meta name="Keywords" content="" />
    <meta name="Description" content="" />
    <script language="javascript">
    <!--
    function ShowHideMenu()
    {
    if (button1.value == "Show")
    {
    menu1.style.display = "";
    button1.value = "Hide";
    }
    else
    {
    menu1.style.display = "none";
    button1.value = "Show";
    }
    }
    //-->
    </script>
    </head>

    <body>
        <input id="button1" type="button" onclick="ShowHideMenu();" value="Show">
    <div id="menu1" style="display:none">        
    <table width="208" height="278" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCFF">
              <tr>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td>&nbsp;</td>
              </tr>
            </table>
    </div>
        </body>
    </html>
    呵呵,发分!