<!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. Mtk Android编译命令

    一.输入命令: cbk@YCS:~/work/k6/alps$ ./mk help Usage: (makeMtk|mk) [options] project actions [modules] Op ...

  2. umount移动硬盘遇到device is busy问题

    #umount  /mnt/fourtumount: /mnt/fourt: device is busy.        (In some cases useful info about proce ...

  3. [CFGym101061G] Repeat it(逆元)

    题目链接:http://codeforces.com/gym/101061/problem/G 题意:给一个数字n,让你重复m次,求最后这个数对1e9+7取模的结果. 思路:设数字n长度为k,重复m次 ...

  4. leetcode:Number of 1 Bits

    Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also know ...

  5. 《自己动手写操作系统》pmtest2笔记

    ;DispReturn模拟一个回车的显示,(让下一个要显示的字符在下一行的开头处显示),其中edi始终指向要显示的下一个字符的位置.;   ------------------------------ ...

  6. Javaweb里面的filter,listener,servlet

    Filter 1Filter是什么:是过滤器简称 2Filter有什么作用:在filter中可以得到代表用户请求和响应的request.response对象,因此在编程中可以使用Decorator(装 ...

  7. 用于科创的git log美化输出

    git log --reverse --pretty=format:'%cd %s' --date=short > a.txt 更好的: git log --reverse --pretty=f ...

  8. C++编程常见错误

    1.成员变量要记得在构造函数中初始化 2.还是初始化!初始化!初始化!

  9. Microsoft Visual Studio Web 创作组件安装失败的解决方法

    在网上查一下说是Office2007的问题.我把Office2007卸载了还是不行. 然后用Windows Install Clean Up工具清理,还是不行. 郁闷了.然后在安装包中的下面路径下找到 ...

  10. Linux上修改weblogic的内存大小

    我们经常在使用WebLoigc部署应用程序后,发现程序运行速度并不是很快,遇到这种情况我们可以尝试调整启动时分配的内存,设置方法有两种: 一.在../domain/setDomainEnv.sh文件中 ...