zoukankan      html  css  js  c++  java
  • js导航制作

    网页部分

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="index.aspx.cs" Inherits="index" %>
    
    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <title></title>
        <link href="css/css1.css" rel="stylesheet" />
        <script src="js/js1.js"></script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div id="map">
            <a href="index.aspx"><div class="choice" style="background-color:gray;">首页</div></a>
             <a href="product.aspx"><div class="choice">产品展示</div></a>
            <a href="about.aspx"> <div class="choice">关于我们</div></a>
            <a href="telephone.aspx"> <div class="choice">联系我们</div></a>
             <a href="join.aspx"><div class="choice">加入我们</div></a>
        </div>
        <br />
        <h1>这是主页!!!!</h1>
        </form>
    </body>
    </html>

    js部分

    window.onload = function () {
    
        var oDivs = document.getElementsByClassName('choice');
        for (var i = 0; i < oDivs.length; i++) {
            if (oDivs[i].style.backgroundColor !='gray') {
                oDivs[i].onmouseover = function () {
                    this.style.backgroundColor = '#0ff';
                }
                oDivs[i].onmouseout = function () {
                    this.style.backgroundColor = 'blue';
                }
            }
    
        }
    
    }//onload结束

    css部分

    *
    {
        padding:0px;
        margin:0px;
    }
    #map
    {
        580px;
        height:50px;
        position:relative;
        margin:0 auto;
    }
    .choice
    {
        100px;
        height:50px;
        position:relative;
        float:left;
        margin-left:5px;
        font-family:微软雅黑;
        color:white;
        text-align:center;
        line-height:50px;
        background-color: blue;
        
    }

  • 相关阅读:
    完整的UED流程
    curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
    部署方案模板
    商城项目合作
    架构师分类
    k8s视图
    虚拟化通信技术
    AxureRP8 实现时间功能
    在AxureRP8中实现广告文字滚动效果
    获取当前网络中的电脑数目及MAC-通过MAC查找IP-通过IP查询机器名
  • 原文地址:https://www.cnblogs.com/fengsantianya/p/5713380.html
Copyright © 2011-2022 走看看