onmouseover(HTML元素)

2023-05-16

描述 (Description)

The onmouseover attribute is one of the most commonly used event attributes. It captures the moment that a cursor crosses the boundary of an element, moving from outside to inside the element to which the attribute is applied. It differs from the onmousemove attribute, which is used to detect movement within the element’s boundaries. Once the cursor is positioned over the element, the onmouseover event remains active until the cursor is moved beyond the element’s boundaries—an event that the onmouseout attribute would capture.

onmouseover属性是最常用的事件属性之一。 它捕获了光标越过元素边界的时刻,该时刻从应用属性的元素从外部移到内部。 它不同于onmousemove属性,后者用于检测元素边界内的移动。 一旦将光标定位在元素上,onmouseover事件将保持活动状态,直到将光标移到元素的边界之外— onmouseout属性将捕获该事件。

The onmouseover attribute is mostly used to render visual effects such as image swapping or color changes, and has been used in this way for almost as long as JavaScript has been around.

onmouseover属性主要用于呈现视觉效果,例如图像交换或颜色变化,并且几乎一直存在JavaScript时就一直以这种方式使用。

Note that this event attribute cannot be applied to the following elements:

请注意,此事件属性不能应用于以下元素:

  • applet

    小程序
  • base

    基础
  • basefont

    基本字体
  • bdo

    do
  • br

    br
  • font

    字形
  • frame

  • frameset

    框架集
  • head

  • html

    html
  • iframe

    iframe
  • isindex

    索引
  • meta

  • param

    参数
  • script

    脚本
  • style

    样式
  • title

    标题

(Example)

The example below shows a simple image swap technique, whereby mousing over the image causes the image to change to one that reveals a location on a map:

下面的示例显示了一种简单的图像交换技术,通过将鼠标悬停在图像上,图像会变为显示地图上某个位置的图像:

<div>
  <img src="map.gif" alt="Hover to reveal the location on the map"
      onmouseover="this.src='map_location_revealed.gif';"
      onmouseout="this.src='map.gif';"/>Figures for February’s racing.
</div>

(Value)

This attribute has no fixed value. It’s up to the author to decide on the scripting that’s included here, be that a call to one or more defined functions, or a simple alert() statement.

此属性没有固定值。 由作者决定此处包含的脚本,是对一个或多个定义的函数的调用,还是简单的alert()语句。

兼容性 (Compatibility)

Internet ExplorerFirefoxSafariOpera
5.56.07.01.01.52.01.32.03.09.29.5
FullFullFullFullFullFullFullFullFullFullFull
IE浏览器 火狐浏览器 苹果浏览器 歌剧
5.5 6.0 7.0 1.0 1.5 2.0 1.3 2.0 3.0 9.2 9.5
充分 充分 充分 充分 充分 充分 充分 充分 充分 充分 充分

Every browser listed supports this attribute. However, inline event handlers such as this should be avoided. In the same way that inline CSS styles are frowned upon but externally defined CSS styles are considered good practice, inline event handlers should be stripped out and replaced with events attached unobtrusively through the DOM.

列出的每个浏览器都支持此属性。 但是,应避免使用此类内联事件处理程序。 与不赞成使用内联CSS样式,但将外部定义CSS样式视为一种好习惯一样,应删除内联事件处理程序,并用通过DOM附加地添加事件来代替。

翻译自: https://www.sitepoint.com/onmouseover-html-element/

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

onmouseover(HTML元素) 的相关文章

随机推荐

  • Docker无介绍快使用,docker拉取Nginx(六)

    Docker无介绍快使用 xff0c docker拉取Nginx xff08 六 xff09 问题背景Docker无介绍快使用 xff0c 安装部署hello测试 xff08 一 xff09 Docker无介绍快使用 xff0c docke
  • 【教程向】通过windows在树莓派3B上安装Ubuntu MATE 16.04.2 (Xenial)

    本文参考了http www ituring com cn article 273613 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 6
  • Docker无介绍快使用,docker拉取rabbitmq(十三)

    Docker无介绍快使用 xff0c docker拉取rabbitmq xff08 十三 xff09 问题背景Docker无介绍快使用 xff0c 安装部署hello测试 xff08 一 xff09 Docker无介绍快使用 xff0c d
  • 【ROS2&AI】电脑摄像头、intel-D435,利用ros2发布订阅图像(Python)

    本文欲分享两个代码来实现图像的传输 xff0c 利用ros2 xff0c ROS2 xff5e 配置 xff1a Ubuntu20 04 Python ROS2 foxy opencv xff1b 电脑相机 or Intel D435相机
  • 2021年嵌入式面试题汇总(最新经典)

    写在前面 xff1a 秋招嵌入式开发方向 xff0c 经过了很多场的笔试与面试 xff0c 在准备的过程中看了非常多的资料 xff0c 现在把他们整理一下 xff0c 有的资料看过了觉得不错就保存下来了 xff0c 如果有不对的地方 xff
  • 垂直起降无人机 Gazebo + PX4 HITL simulation

    环境 xff1a ubuntu版本 xff1a 20 04 px4固件版本 xff1a stable v1 12 3 QgroundControl版本 xff1a v4 14 飞控硬件 xff1a pixhawk cuav v5 43 ga
  • PX4飞控源码L1制导律详解

    PX4飞控源码L1制导律详解 本文目的在于帮助大家看清楚L1制导律选择参考点的策略 xff0c 所以作者将与L1知道无关的代码添加删除线 所有以下划线开头的变量在PX4中都是全局变量 xff0c 在下面的函数中 xff0c 有 target
  • Ubuntu下PX4飞控开发环境搭建

    双清微电子 前言 xff1a PX4支持Pixhawk pixracer 高通骁龙飞控板 树莓派 派诺特等硬件 PX4是构建在Nuttx实时操作系统上的 第一步 xff1a 安装Linux基础软件 第二步 xff1a 下载源代码 第三步 安
  • 开源飞控APM/PX4的发展史

    开源 Open Source 的概念最早被应用于软件 xff0c 开放源代码促进会 Open Source Initiative 用其描述那些源码可以被公众使用的软件 xff0c 并且此软件的使用 修改和发行也不受许可证的限制 每一个开源项
  • Mexican lolita ghds sale images

    The clip on hair extensions are available cheap ghd a variety of different colors and lengths will be the very best choi
  • python 获取当前文件路径

    一 Python 获取当前文件路径方法 sys path 0 获取文件当前工作目录路径 绝对路径 sys argv 0 获得模块所在的路径 由系统决定是否是全名 若显示调用python指令 xff0c 如python demo py xff
  • C#下使用RealSense D435i获取图像,深度,导出.ply点云

    首先需要在NuGet管理中安装RealSense库相关包 主要安装下面两个包 xff1a 代码中引入 xff1a using Intel RealSense 配置相机 var cfg 61 new Config using var ctx
  • 小觅的简单代码程序实现

    96 from future import print function import os import sys PY DIR 61 os path dirname os path dirname os path abspath file
  • TCP 服务器程序突然中断 由于send函数导致

    最近在写tcp 客户端服务器操作 设置服务器为单线程多个客户端连入 开发过程中出现 服务器代码运行过程中 在send处突然中断情况 通过GDB调试发现send函数报错提示打开文件错误 由于测试过程纵单节点反复连入客户端 在client so
  • 从高考到程序员

    从高考到程序员 说真的 xff0c 我做梦也没有想到我会去做程序员 xff0c 一个高中我一直不敢也不想碰到的职业 然而 xff0c 我现在却成为了一位程序员 xff0c 有时候 xff0c 人生真的有点戏剧性 上高中时的我对未来真的是没有
  • 关于单链表的理解

    链表是一种物理 存储单元上非连续 非顺序的 存储结构 xff0c 数据元素的逻辑顺序是通过链表中的 指针链接次序实现的 链表由一系列结点 xff08 链表中每一个元素称为结点 xff09 组成 xff0c 结点可以在运行时动态生成 每个结点
  • rc1改为rc2出现的问题1

    同样的代码 xff0c 在rc1运行时正常 xff0c 在rc2第一次运行正常 xff08 控制台比rc1输出了好多信息 xff09 xff0c 再次运行时抛出异常后退出 java 代码 2007 8 8 13 09 26 net jxta
  • 对倒立摆的LQR控制

    1 问题建模 首先对待研究的问题建立数学模型 在倒立摆模型分析这篇文章里 xff0c 我们已经做了完整的受力分析 最终得到了关于系统变量的微分方程 M 43 m
  • 如何在VirtualBox中使用分支快照

    VirtualBox has supported virtual machine VM snapshots for a while However until version 3 1 it was only possible to reve
  • onmouseover(HTML元素)

    描述 Description The onmouseover attribute is one of the most commonly used event attributes It captures the moment that a