日期:2014-05-16 浏览次数:20411 次
<!DOCTYPE HTML> <html> <head> <meta charset="gb2312" /> <title></title> <style> .wrap { position:relative; } .inner { display:none; position:absolute; top:30px; left:100px; width:100px; height:100px; border:1px solid #000; background:#fff; } </style> </head> <body> <div class="wrap"> <img src="http://avatar.profile.csdn.net/0/D/B/2_tan_yixiu.jpg" /> <div class="inner"> 内容 </div> </div> <script> var $ = function(id){ return document.getElementById(id); }; var $t = function(tag, cot){ cot = cot || document; return cot.getElementsByTagName(tag); }; $t('img')[0].onmouseover = function(){ $t('div', this.parentNode)[0].style.display = 'block'; } $t('img')[0].onmouseout = function(){ $t('div', this.parentNode)[0].style.display = 'none'; } </script> </body> </html>
------解决方案--------------------
那个是 jquery tooltip 插件
http://www.cnblogs.com/ywqu/archive/2010/01/31/1660597.html