您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

关于文字提示的实例代码

2024/4/8 10:08:09发布7次查看
注释部分同样可以实现,鼠标移文字上固定位置显示title,不显示默认的title;
html网页主要是用于web站点的制作,对于一个网页用户体验最为重要,如何提升用户体验呢?就要从细节入手。那么html如何给文字链接加上提示呢?
<!doctype html> <html lang="en"> <head>     <meta charset="utf-8">     <title>title</title>     <style>body {             margin: 0;             padding: 40px;             background: #fff;             font: 80% arial, helvetica, sans-serif;             color: #555;             line-height: 180%;         }         p {             clear: both;             margin: 0;             padding: .5em 0;         }/* tooltip */#tooltip {             position: absolute;             border: 1px solid #333;             background: #f7f5d1;             padding: 1px;             color: #333;             display: none;         }</style>     <script src="js/jquery-1.11.3.min.js"></script>     <script>$(function () {//            var v;var x=10;var y=20;             $(a.tooltip).mouseover(function (e) {//                v=$(this).attr(title);//把class .tooltip中的值取到//                $(this).attr(title,);//把原来的titile清空this.mytitle=this.title;this.title=;var tooltip=$(<div id='tooltip'>+this.mytitle+</div>);//把class .tooltip中的值传给新元素#tooltiptooltip.appendto(body);var json={ top:e.pagey+y+px, left:e.pagex+x+px};                 $(#tooltip).css(json).show(fast);             }).mouseout(function () {                 $(#tooltip).remove();//把元素删除,不能用hide();//                $(this).attr(title,v);//把原来的属性值添加回来this.title=this.mytitle;             });         })</script> </head> </head> <body> <p><a href="#" class="tooltip" title="这是我的超链接提示1.">提示1.</a></p> <p><a href="#" class="tooltip" title="这是我的超链接提示2.">提示2.</a></p> <p><a href="#" title="这是自带提示1.">自带提示1.</a></p> <p><a href="#" title="这是自带提示2.">自带提示2.</a></p> </body> </html>
以上就是关于文字提示的实例代码的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product