11.2

  1. 夜间模式的开启与关闭
    1. 放置点击的按钮或图片。
    2. 定义开关切换函数。
    3. onclick函数调用。
  2. 父模板的制作
    1. 制作网站网页共有元素的父模板html,包括顶部导航,中间区块划分,底部导航,底部说明等。
    2. 汇总相关的样式形成独立的css文件。
    3. 汇总相关的js代码形成独立的js文件。
    4. 形成完整的base.html+css+js
      <!DOCTYPE html>
      <html lang="en">
      <head>
          <meta charset="UTF-8">
          <title>登录</title>
          <link rel="stylesheet" type="text/css" href="../static/dl.css">
          <script src="../static/js/denlu.js"></script>
          
      
      </head>
      <nav style="background-color: blanchedalmond">
          <img src="https://haitao.nos.netease.com/e740ea878fa94730b3d86579a8e68a26.jpg" width="600px">
          <input type="text" placeholder="输入你想找的宝贝">
          <input type="button" value="搜索">
          <a>购物车</a>
          <a href="https://www.kaola.com/?navindex=1&zn=top">首页</a>
          <a href="https://www.kaola.com/activity/flashSaleIndex/show.html?navindex=2&zn=top">今日限时购</a>
          <a href="https://www.kaola.com/activity/newArrival.html?navindex=3&zn=top">每日上新</a>
          <img id="myOnOff" onclick="mySwitch()" src="../static/image/on.png" width="40px">
      </nav>
      <body id="myBody">
      <div class="box">
          <div id="tittle"><h2 align="center">登录</h2></div>
          <div class="input_box">
              账户: <input id="uname" type="text" placeholder="请输入用户名">
          </div>
          <div class="input_box">
              密码: <input id="upass" type="password" placeholder="请输入密码">
          </div>
          <div id="error_box"><br></div>
          <div class="input_box">
              <button onclick="foLogin()">登录</button>
          </div>
      
          <button type="button" onclick="foLogin()"><a href="zhuce.html">注册</a></button>
      
      </div>
      
      </body>
      </html>
      box{
            300px;
      }
      
      div.box {
          border: 1px solid #000000;
          height: 290px;
           300px;
          float: left;
          margin: 50px;
          background: antiquewhite;
      }
      
      div.input_box{
          text-align: center;
          height: 50px;
           auto;
          padding: 5px
      }
      
      div.input_box button{
          border: aqua;
          font-size: 20px;
           100px;
          height: 30px;
          background: coral;
      }
      function mySwitch() {
                  var oBady=document.getElementById("myBody");
                  var oOnoff=document.getElementById("myOnOff");
                  if(oOnoff.src.match("on")){
                      oOnoff.src="../static/image/off.png";
                      oBady.style.background="gray";
                      oBady.style.color="white";
                  }else {
                      oOnoff.src = "../static/image/on.png";
                      oBady.style.background = "white";
                      oBady.style.color = "black" ;
                  }
              }

原文地址:https://www.cnblogs.com/chenyanxi123/p/7774132.html