zoukankan      html  css  js  c++  java
  • 妙味——JS学前预热01

    (1)代码效果:

      实现鼠标移入移出经过单选框时显示/隐藏提示信息。

    (2)实现代码:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>Document</title>
    <style>
        #div{width: 100px;background-color: #fcf;border: solid 1px #9fc;padding: 5px;display: none;}
    </style>
    <script>
        
    </script>
    </head>
    <body>
        <input type="checkbox" onmouseover="document.getElementById('div').style.display='block';" onmouseout="document.getElementById('div').style.display='none';" />自动登陆
        <div id="div">不要在网吧等公共场合随意记住密码</div>
    </body>
    </html>

    (3)结果如下图所示:

    (4)学习要点

    JS中的事件
      当...的时候
      onmouseover 、 onmouserout
      alert的使用

    元素获取
      id
      document.getElementById

    属性操作
      obj.style.display='none';
      = 赋值
      . 点————的
      ‘’ 引号

    高否?富否?帅否? 否? 滚去学习!
  • 相关阅读:
    无法远程连接mssqlserver2005服务器的解决
    can't init script for
    为什么要分层?
    如何判断控件是否已加载完成
    社团管理_第4组_需求分析报告
    FSF
    【转载】(翻译)反射的第二部分:Emit
    【转载】Emit学习基础篇基本概念介绍
    白话C#
    GCC
  • 原文地址:https://www.cnblogs.com/baixc/p/3416249.html
Copyright © 2011-2022 走看看