不用脚本虽然也能实现,只是结构和样式相对复杂,不如使用脚本,清晰明了。隐藏显示部分可以为任何想要的内容。代码如下:
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
html xmlns=http://www.w3.org/1999/xhtml
head
meta http-equiv=Content-Type content=text/html; charset=utf-8 /
titleexample/title
script type=text/javascript src=http://code.jquery.com/jquery-1.4.1.min.js/script
script type=text/javascript
$(function(){
$('#divcon').hide();
$('#aa').hover(function(){$('#divcon').show();},function(){$('#divcon').hide();});
});
/script
style type=text/css
!--
body{ color:#000; font:12px Arial, Helvetica, sans-serif;}
#aa{ color:#000; text-decoration:none;}
#divcon{ background:#eee; padding:10px; width:150px;}
--
/style
/head
body
a id=aa href=#我是链接,鼠标过来/a
div id=divcon隐藏的任意内容,鼠标移到链接上出现,移开即隐藏!/div
/body
/html
取消
评论