<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<style>
body {
margin: 0;
padding: 0;
}
p {
width: 600px;
position: fixed;
bottom: 5px;
}
span[title]{
color: green;
position: relative;
}
span {
color: red;
}
span.title {
color: black;
position: absolute;
line-height: 26px;
padding: 0 5px;
background: #FFFFCA;
border: 1px solid #000;
z-index: 1;
white-space: nowrap;
top: 18px;
left: 0;
position: absolute;
display: none;
}
</style>
<script type="text/javascript">
function getPos(obj)
{
var pos = {left:0, top:0 };
while(obj)
{
pos.left += obj.offsetLeft;
pos.top += obj.offsetTop;
obj = obj.offsetParent;
}
return pos;
}
</script>
<script type="text/javascript">
window.onload = function ()
{ var op = document.getElementsByTagName('p')[0];
var aspan = document.getElementsByTagName('span'); op.style.left = (document.documentElement.clientWidth - op.offsetWidth)/2 + 'px'; window.onreset = function ()
{
op.style.left = (document.documentElement.clientWidth - op.offsetWidth )/2 + 'px';
}; for( var i = 0 ; i < aspan.length; i++ )
{
if(aspan[i].getAttribute('title'))
{
var otip = document.createElement('span');
otip.className = 'title';
otip.innerHTML = aspan[i].title;
aspan[i].appendChild(otip); aspan[i].onmouseover = function ()
{
this.children[0].style.display = 'block';
if(getPos(aspan[i].children[0]).top + 26 > document.documentElement.clientLeft + document.body.scrollHeight)
{
this.children[0].style.top = '-30px';
}
}; aspan[i].onmouseout = function ()
{
this.children[0].style.display = 'none';
};
}
} var str = aspan[0].children[0].innerHTML;
aspan[0].children[0].innerHTML = str.split('JavaScript').join('<span style = "color:red;font-weight:bold;">JavaScript</span>') };
</script>
</head> <body>
<p>
<span title="JavaScript是一门很热门的语言">JavaScript</span>是面向Web的编程语言,绝大多数现代网站都使用了<span title="JavaScript">JavaScript</span>,并且所有的现代<span title="Web">Web</span>浏览器——基于<span>桌面系统</span>、游戏机、平板电脑和智能手机的浏览器——均包含了<span title="JavaScript">JavaScript</span>解释器。这使得<span title="JavaScript">JavaScript</span>能够称得上史上最广泛的编程语言。<span title="JavaScript">JavaScript</span>也是前端开发工程师必须掌握的三种技能之一,描述网页内容的<span title="HTML">HTML</span>、描述网页样式的<span title="CSS">CSS</span>以及描述网页行为的<span title="JavaScript">JavaScript</span>。
</p>
</body>
</html>

dom 关键字提示的更多相关文章

  1. 解决方案:Resharper对系统关键字提示‘can not resolve symbol XXX’,并且显示红色,但是编译没有问题

    环境:Visual studio 2013 community update 4 + Resharper 8.2 + Windows 7现象:我的C#工程编译没有问题, 但是在代码编辑器中系统关键字显 ...

  2. 【转载】解决方案:Resharper对系统关键字提示‘can not resolve symbol XXX’,并且显示红色,但是编译没有问题

    环境:Visual studio 2013 community Update 4 + Resharper 8.2 + Windows 7 现象: 我的C#工程编译没有问题, 但是在代码编辑器中系统关键 ...

  3. 基于vue的多引擎搜索及关键字提示

    关键代码: <div class="header-search"> <form id="form" action="http://m ...

  4. CSS关键词的值-currentColor关键字提示文字(当前颜色)

    currentColor关键字 currentColor关键字相当于一个CSS变量. currentColor关键字与CSS变量也是有区别的: (1)他只可以能接受<color>值的地方使 ...

  5. input 关键字提示,对于一些特定优化来说,很有用处

    只用html就可以做出提醒操作:效果如下图 这里是代码,怎么样,很简单吧 <form action="/server" method="post"> ...

  6. 使用jsonp跨域调用百度js实现搜索框智能提示,并实现鼠标和键盘对弹出框里候选词的操作【附源码】

    项目中常常用到搜索,特别是导航类的网站.自己做关键字搜索不太现实,直接调用百度的是最好的选择.使用jquery.ajax的jsonp方法可以异域调用到百度的js并拿到返回值,当然$.getScript ...

  7. Visual Studio 2013 在使用 MVC5 无智能提示

    关于 Visual Studio 2013 在使用 MVC5 无智能提示的问题,类库无法正常识别,连最基本的关键字提示都没有了,类变色也没有了,所有的关键字代码,类名,方法成员名都要全部手动敲 原因: ...

  8. new 关键字

    学习过的调用或者是执行函数的方式有几种? ①函数名+小括号 ②事件处理函数 ③定时器 ④数组里面的元素是函数,枚举出来执行 ⑤new关键字 提示:需要注意new 关键字需要在函数名前面使用 构造函数是 ...

  9. Phaser游戏框架与HTML Dom元素之间的通信交互

    本想按照PHASER的HTML Dom元素官方实例:http://labs.phaser.io/index.html?dir=game%20objects/dom%20element/&q=  ...

随机推荐

  1. python下载图片

    import re import  urllib.request   def getHtml(url): page = urllib.request.urlopen(url) html = page. ...

  2. 用VS2005开发WinCE程序调试图文教程

    一.WinCE 模拟器通过ActiveSync 6.1(即Windows Mobile设备中心)连接P 1.启动WinCE模拟器 命令行:  start .\DeviceEmulator.exe WI ...

  3. staging server, source congtrol, deply workflow using git

    web项目开发中,有三个实践对于项目成功是非常重要的: 1. staging servers 2. Version control workflows 3. Tested, repeatable de ...

  4. 51nod1199 Money out of Thin Air

    链剖即可.其实就是利用了链剖后子树都在一段连续的区间内所以可以做到O(logn)查询和修改. 线段树细节打错了..要专心!肉眼差错都能找出一堆出来显然是不行的!. #include<cstdio ...

  5. DOM应用

    父级.removeChild(子节点);父级.appendChild(子节点);父级.insertBefore(子节点, 在谁之前); 创建元素: <script> window.onlo ...

  6. WEBUS2.0 In Action - 搜索操作指南 - (2)

    上一篇:WEBUS2.0 In Action - 搜索操作指南(1) | 下一篇:WEBUS2.0 In Action - 搜索操作指南(3) 2. 使用Query Query是所有查询的基类, 它一 ...

  7. singleton单例模式

    单例设计模式 单例设计模式概述    单例模式就是要确保类在内存中只有一个对象,该实例必须自动创建,并且对外提供    优点:    在系统内存中只存在一个对象,因此可以解决系统资源,对于一些需要频繁 ...

  8. POJ 1201 Intervals (差分约束,最短路)

    题意: 有一个集合Z,其元素都是整整数,但是数量未知.现有n个约束,形如 [a,b]=c 表示整数区间[a,b]中有c个元素在Z中出现.问集合Z最小可能含多少个元素? 思路: 对于所给的区间 cnt[ ...

  9. HDU 5038 Grade

    解题思路:这题最关键的是要读懂题意,If not all the value are the same but the frequencies of them are the same, there ...

  10. java中正则表达式的应用

    java.util.regex   Pattern的应用 public static void main(String[] args) { //简单的正则匹配.从给定的字符串中匹配正则表达式 //匹配 ...