javascript当鼠标经过时即使提示消息的2种方法

1.用<SPAN Title=“要提示的内容”>

2.用<a>结合鼠标的OnMourseMove和OnMouserOut事件在状态栏中显示

 

实列代码如下:

  1. <!HTML4.0规范,不可少哦>
  2. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
  3. <html>
  4. <head>
  5. <title>鼠标显示提示文字</title>
  6. <!STYLE元素定义顶级元素BODY与行内元素SPAN的样式>
  7. <style>
  8. span{background-color:yellow;}
  9. body{cursor:default;}
  10. </style>
  11. </head>
  12. <body>
  13. <p>
  14. <span title="Christmas--n.圣诞节">Christmas</span> is an important <span title="festival--adj.节日(的),喜庆(的)">festival</span> in <span title="Britain--n.大不列颠">Britain</span> and many other parts of the world!
  15. </P>
  16. <p>
  17. <!用超链元素A.../A将要设置提示信息的单词分别设成超链形式>
  18. <!HREF元素的值设置为"javascript:void(null)"表示该链接为空链接,不链接到其他地方> 
  19. <!onMouseMove事件设置鼠标移动到该链接时的提示信息,而不是onMouseOver>
  20. <!onMouseOut事件设置鼠标离开该链接时的提示信息为空白,即将提示信息清除>
  21. <!window.status="某个字符串"表示在状态行设置提示信息>
  22. <a href="javascript:void(null)" onMouseMove="window.status='Christmas--n 圣诞节'" onMouseOut="window.status=''">Christmas</a> is an important festival in Britain and many other parts of the world!
  23. </p>
  24. </body>
  25. </html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值