为了账号安全,请及时绑定邮箱和手机立即绑定

使用JS做下拉菜单,子菜单不显示

使用JS做下拉菜单,子菜单不显示

1y1 2016-12-17 19:22:10
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title><style type="text/css">*{    margin: 0;    padding: 0;}a{    text-decoration: none;}#fa{    display: block;    width: 100px;    height: 30px;    line-height: 30px;    text-align: center;        background: green;    color: yellow;}#fa:hover{    background: orange;    color: black;}#son{    width: 100px;    list-style: none;    display: none;}ul a{    display: block;    width: 100px;    height: 30px;    background: #CCC;    line-height: 30px;    text-align: center;    border-bottom: 4px solid red;    color: green;}</style><script type="text/javascript">function in(){    var lo=document.getElementById('son');    if (lo.style.display==none)     {        lo.style.display='block';    }    else{        lo.style.display='none';        }}</script></head><body><a id="fa" href="#" onmouseover="in()">我是父目录</a><ul id="son">    <li><a href="#">我是子目录</a></li>    <li><a href="#">我是子目录</a></li>    <li><a href="#">我是子目录</a></li>    </ul>    <!-- <input type="button" value="点击取消!" onclick="reset()" /> --></body></html>1、ul未使用定位不知道是否有关;2、js初学,if的用法搞不懂对不对。PS:0基础在家自学,不懂的没人指导,求指点!!!!
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 2631 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信