跪求 各位大神 帮忙写一段 鼠标移过去 有下拉的js(如图)最好是简单点的 不要用到 jquery 的 谢谢啦!!
1个回答
2014-04-19
展开全部
<!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" />
<title>无标题文档</title>
<style type="text/css">
<!--
a {
text-decoration:none;
}
ul {
list-style-type: none;
width: 120px;
height:0px;
margin: 0px;
padding: 0px;
border: 1px solid #CCC;
overflow:hidden;
display:none;
position:absolute;
}
li {
line-height:30px;
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #CCC;
}
-->
</style>
</head>
<body>
<a href="#">我的知道</a>
<ul>
<li><a href="#">我的知道</a></li>
<li><a href="#">我的提问</a></li>
<li><a href="#">为我推荐的问题</a></li>
</ul>
</body>
</html>
<script language="javascript">
var a = document.getElementsByTagName("a")[0];
var ul = document.getElementsByTagName("ul")[0];
var sheef = document.styleSheets[0];
var id = 0;
var speed = 10;
a.onmouseover = show;
ul.onmouseout = function()
{
}
function show()
{
a.onmouseover = null;
sheef.rules[1].style.display = "block";
id = window.setInterval( function() {
sheef.rules[1].style.height = $(sheef.rules[1].style.height) + speed + "px";
if ($(sheef.rules[1].style.height) >= 90 )
{
window.clearInterval(id);
}
}, 10 );
}
function $(str)
{
str = str.substr(0, str.length-2);
return parseInt(str);
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
<!--
a {
text-decoration:none;
}
ul {
list-style-type: none;
width: 120px;
height:0px;
margin: 0px;
padding: 0px;
border: 1px solid #CCC;
overflow:hidden;
display:none;
position:absolute;
}
li {
line-height:30px;
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #CCC;
}
-->
</style>
</head>
<body>
<a href="#">我的知道</a>
<ul>
<li><a href="#">我的知道</a></li>
<li><a href="#">我的提问</a></li>
<li><a href="#">为我推荐的问题</a></li>
</ul>
</body>
</html>
<script language="javascript">
var a = document.getElementsByTagName("a")[0];
var ul = document.getElementsByTagName("ul")[0];
var sheef = document.styleSheets[0];
var id = 0;
var speed = 10;
a.onmouseover = show;
ul.onmouseout = function()
{
}
function show()
{
a.onmouseover = null;
sheef.rules[1].style.display = "block";
id = window.setInterval( function() {
sheef.rules[1].style.height = $(sheef.rules[1].style.height) + speed + "px";
if ($(sheef.rules[1].style.height) >= 90 )
{
window.clearInterval(id);
}
}, 10 );
}
function $(str)
{
str = str.substr(0, str.length-2);
return parseInt(str);
}
</script>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询