• onmouseover 事件


    定义和用法

    onmouseover 事件会在鼠标指针移动到指定的对象上时发生。

    语法

    onmouseover="SomeJavaScriptCode"
    参数描述
    SomeJavaScriptCode 必需。规定该事件发生时执行的 JavaScript。

    支持该事件的 HTML 标签:

    <a>, <address>, <area>, <b>, <bdo>, <big>, <blockquote>, <body>, <button>, 
    <caption>, <cite>, <code>, <dd>, <dfn>, <div>, <dl>, <dt>, <em>, <fieldset>, 
    <form>, <h1> to <h6>, <hr>, <i>, <img>, <input>, <kbd>, <label>, <legend>, 
    <li>, <map>, <ol>, <p>, <pre>, <samp>, <select>, <small>, <span>, <strong>, 
    <sub>, <sup>, <table>, <tbody>, <td>, <textarea>, <tfoot>, <th>, <thead>, 
    <tr>, <tt>, <ul>, <var>
    

    支持该事件的 JavaScript 对象:

    layer, link

    实例 1

    在下面的例子中,我们将在用户把鼠标指针移动到图像上时显示一个对话框:

    <img src="/i/eg_mouse2.jpg" alt="mouse"
    onmouseover="alert('您的鼠标在图片上!')" />

    输出:(请把鼠标移动图片上):

    Visit W3School!

    实例 2

    下面的例子中,我们将在网页上添加一个用作连接按钮的图像,然后我们会添加 onMouseOver 和 onMouseOut 事件,这样就可以在运行两个 JavaScript 函数来切换两幅图像:

    <html>
    <head>
    <script type="text/javascript">
    function mouseOver()
    {
    document.getElementById('b1').src ="/i/eg_mouse.jpg"
    }
    function mouseOut()
    {
    document.getElementById('b1').src ="/i/eg_mouse2.jpg"
    }
    </script>
    </head>
    
    <body>
    <a href="http://www.w3school.com.cn" 
    onmouseover="mouseOver()" onmouseout="mouseOut()">
    <img alt="Visit W3School!" src="/i/eg_mouse2.jpg" id="b1" />
    </a>
    </body>
    </html>

    输出:

    Visit W3School!

    TIY

    onmouseover
    如何使用 onmouseover。
  • 相关阅读:
    [HAOI 2007]上升序列
    转载:分布式与集群的区别究竟是什么?
    转载:5个顶级异步Python框架 https://geekflare.com/?s=python
    代码走读 airflow
    走读中学到的技巧 airflow
    sqlalchemy 相关
    pandas 筛选
    pandas IO
    服务端高并发分布式架构演进之路 转载,原文地址:https://segmentfault.com/a/1190000018626163
    pandas 6 时间
  • 原文地址:https://www.cnblogs.com/mfryf/p/3119920.html
Copyright © 2020-2023  润新知