乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      JavaScript連載32-常用的鼠標(biāo)事件

       丹楓無跡 2021-09-19

      一、常用的鼠標(biāo)事件

      <body>
          <img src="img/img_05.png" alt="" width="250px">
          <script>
              window.onload = function (ev) {
                  var logo = document.getElementsByTagName("img")[0];
      
                  //1.新的事件
                  logo.onmouseover = function (e1) {
                      console.log("-----");//鼠標(biāo)進(jìn)入圖片就會觸發(fā),也就懸停在圖片上
                      this.setAttribute("src","img/img_02.png");
                  }
                  
                  logo.onmouseleave = function (e2) {
                      this.setAttribute("src","img/img_05.png");//鼠標(biāo)離開圖片就會觸發(fā)
                  }
              }
          </script>
      </body>
      </html>

      在這里插入圖片描述

      二、側(cè)邊的顯示和隱藏

      <!DOCTYPE html>
      <html lang="en">
      <head>
          <meta charset="UTF-8">
          <title>D32_3_erweimaXianshi</title>
          <style>
              *{
                  margin:0;
                  padding:0;
                  list_style:none;
              }
              #e_coder{
                  width:500px;
                  height:500px;
                  background:url("img/img_05.png") no-repeat;
                  position:fixed;
                  top:40%;
                  left:0;
                  cursor:pointer;
              }
              #e_app{
                  position:absolute;
                  left:50px;
                  top:-50px;
                  display: none;
              }
          </style>
      </head>
      <body>
          <div id="e_coder">
              <div id="e_app">
                  <img src="img/img_02.png" alt="公眾號" width="150">
              </div>
          </div>
          <script>
              window.onload = function (ev1) {
                  //1.獲取需要的標(biāo)簽
                  var e_coder = document.getElementById("e_coder");
                  var e_app = document.getElementById("e_app");
      
                  //2.監(jiān)聽鼠標(biāo)
                  e_coder.onmouseover = function (ev2) {
                      //2.1改變背景圖片
                      this.style.background = 'url("img/img_03.png") no_repeat';
                      //2.2顯示二維碼
                      e_app.style.display = "block";
                  }
      
                  e_coder.onmouseover = function (ev3) {
                      this.style.background = 'url("img/img_04.png") no_repeat';
                      e_app.style.display = "none";
                  }
              }
          </script>
      </body>
      </html>

      32.2

      • 用于顯示側(cè)邊欄的圖片,鼠標(biāo)如果放到上面就會顯示二維碼,離開的話就會隱藏二維碼,這個和我們之前講的靜態(tài)網(wǎng)頁的動畫是有本質(zhì)區(qū)別的,這個是動態(tài)網(wǎng)頁,并非是靜態(tài)動畫。

      三、源碼:

      • D32_1_JS.html

      • D32_2_CommonMouse.html

      • D32_3_erweimaXianshi.html

      • 地址:https://github.com/ruigege66/JavaScript/blob/master/D32_1_JS.html

      • https://github.com/ruigege66/JavaScript/blob/master/D32_2_CommonMouse.html

      • https://github.com/ruigege66/JavaScript/blob/master/D32_3_erweimaXianshi.html

      • 博客園:https://www.cnblogs.com/ruigege0000/

      • CSDN:https://blog.csdn.net/weixin_44630050?t=1

        本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多