zoukankan      html  css  js  c++  java
  • 夜间模式的开启与关闭,父模板的制作

    1. 夜间模式的开启与关闭
      1. 放置点击的按钮或图片。
      2. 定义开关切换函数。
      3. onclick函数调用。、
    HTML:
    <!
    DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>夜间模式</title> <script> function mySwitch(){ var oBody = document.getElementById("myBody"); var oOnoff = document.getElementById("myOnOff"); if(oOnoff.src.match("on")){ oOnoff.src="../static/img/off.jpg"; oBody.style.background="#303030 "; oBody.style.color="white"; }else { oOnoff.src="../static/img/on.jpg"; oBody.style.background="white"; oBody.style.color="gray"; } } </script> </head> <body id="myBody"> <img id="myOnOff" onclick="mySwitch()" src="../static/img/on.jpg" width="40px"> <script> document.write(Date()) </script> </body> </html>
    1. 父模板的制作
      1. 制作网站网页共有元素的父模板html,包括顶部导航,中间区块划分,底部导航,底部说明等。
      2. 汇总相关的样式形成独立的css文件。
      3. 汇总相关的js代码形成独立的js文件。
      4. 形成完整的base.html+css+js
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>baseTest</title>
        <link rel="stylesheet" type="text/css" href="../static/css/base.css">
    </head>
    <base href="http://www.xiami.com/">
    
    <div class="navbar">
        <nav class="navbar-top">
            <li type="submit" class="active"><a href="" target="_blank">首页</a></li>
            <li type="submit"><a href="#">歌单</a></li>
            <li type="submit"><a href="#">电台</a></li>
            <li type="submit"><a href="#">音乐人</a></li>
            <input type="text" id="select" placeholder="音乐搜索,找人">
            <li type="submit" id="submit"><a href="#">搜索</a></li>
    
            <li style="float:right" type="submit"><a href="login.html" target="_blank">登录</a></li>
            <li style="float:right" type="submit"><a href="register.html" target="_blank">注册</a></li>
    
    
        </nav>
    </div>
    <div class="navbar-down">
      <a href="#">Test1</a>
      <a href="#">Teat2</a>
      <a href="#">Test3</a>
      <a style="float: right " href="#">Test4</a>
    
    
    </div>
    <body>
    
    
    </body>
    </html>

    HTML

    .navbar-top{
        list-style-type: none;
        margin: 0;
        padding: 0;
        overflow: hidden;
        background-color: gray;
        }
    li{
        float: left;
        border-right:1px solid #bbb;
    }
    li:last-child {
        border-right: none;
    }
    li a {
        display: block;
        color: white;
        text-align: center;
        padding: 14px 16px;
        text-decoration: none;
        font-size: 15px;
    }
    li a:hover:not(.active) {
        background-color: #111;
    }
    .active {
        background-color: #0099CC;
    }
    #select{
        margin-top: 10px;
        width: 200px;
        height: 23px;
        font-size: 15px;
    }
    .navbar-down{
        overflow: hidden;
        background-color: gray;
        position: fixed;
        bottom: 0;
        width: 100%;
    }
    .navbar-down a{
        float: left;
        display: block;
        color: #f2f2f2;
        text-align: center;
        padding: 12px 14px;
        text-decoration: none;
        font-size: 15px;
    }

    CSS

  • 相关阅读:
    腾讯TencentOS正式开放测试:支持“傻瓜式刷机”-android
    glob.h and glob.c for the Android NDK
    (OK) 在CentOS7—编译OpenSSL 静态库—for—Android
    Android
    Pass data to CGI script and back with jQuery.ajax
    yum—repo—How to Enable EPEL Repository for RHEL/CentOS 7/6/5
    裸机版的hello world
    CodeBlock 使用手册
    (NOT OK) How To Build CyanogenMod Android for Motorola Defy ("jordan")
    error: .repo/manifests/: contains uncommitted changes 解决办法
  • 原文地址:https://www.cnblogs.com/liminghui3/p/7774563.html
Copyright © 2011-2022 走看看