JS( 1 )練習

來源:互聯網
上載者:User

標籤:style   java   color   os   strong   io   cti   html   

<!doctype html> <html lang="en">  <head>   <meta charset="UTF-8">   <title>JS練習第一課</title>  </head>  <link id="bg" rel="stylesheet" type="text/css" href="">  /這裡是給了引入的樣式表一個ID,空值它引入的樣式地址/  <style type="text/css">  div{    color:#FFF;    font-size:16px;    font-family:microsoft yahei;    font-weight:700;    line-height:50px;    text-align:center;    border:1px solid blue;     display:none;    //div預設為隱藏  }  </style>  <script type="text/javascript">     function bloc()  //滑鼠移至上方執行此函數,onmouseover    {      var aDiv=document.getElementById(‘div1‘);   /擷取div1這個ID,並給他取個名字為aDiv/ var aBg=document.getElementById("bg");   /擷取bg這個ID ,並給他取個名字為aBg / aDiv.style.display="block"   /讓它的display顯示/ aDiv.style.background="pink"   /讓它的背景變為粉色/ aDiv.style.width="180px"   /讓它的寬變為180像素/ aDiv.style.height="50px"   /讓它的高變為50像素/ aBg.href="a.css"    }     function non()  //滑鼠移除執行此函數,onmouseout    {      var aDiv=document.getElementById(‘div1‘);   /擷取div1這個ID,並給他取個名字為aDiv/ var aBg=document.getElementById("bg");   /擷取bg這個ID ,並給他取個名字為aBg / aDiv.style.display="none";   /讓它的div隱藏/ aBg.href="" /讓它href為空白,不引入樣式表/    }
 </script>  <body> <label onmouseover="bloc();" onmouseout="non()" ><input type="checkbox">儲存密碼</label> /滑鼠放在此處可以出現效果/   <div id="div1">不要在公用場合儲存密碼</div>   /此div預設為隱藏/  </body> </html>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.