分类: 情感生活类一览众群山小 |
关注冰河博客每天都有不一样的精彩,效果直逼flash的css+div+js菜单代码如下:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>css 菜单</title>
<style>
body{
background-color:#B8B8A0;
}
#fbtn{
display:none;
overflow:hidden;
border-style:solid;
border-width:1px;
border-color:#e1e1c9 #e1e1c9 #6e6e56
#6e6e56;
padding:1 1 1 1;
width:150px;
height:30px;
}
#fbtn_txt{
position:relative;
}
#fbtn_txt div{
height:30px;
padding-top:11px;
font-size:9px;
font-family:small fonts;
color:#800080;
text-align:center;
cursor:hand;
}
#fbtn_mask{
background-color:#ffffff;
position:relative;
width:100%;
height:100%;
}
</style>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>css 菜单</title>
<style>
body{
#fbtn{
#fbtn_txt{
#fbtn_txt div{
#fbtn_mask{
</style>
</head>
<body>
<div id=fbtn>
<div id=fbtn_mask></div>
<div id=fbtn_txt>
<div>G1</div>
<div>good morning</div>
</div>
</div>
<div id=fbtn>
<div id=fbtn_mask></div>
<div id=fbtn_txt>
<div>G2</div>
<div>good evening</div>
</div>
</div>
<div id=fbtn>
<div id=fbtn_mask></div>
<div id=fbtn_txt>
<div>M1</div>
<div>my name is fireyy</div>
</div>
</div>
<div id=fbtn>
<div id=fbtn_mask></div>
<div id=fbtn_txt>
<div>M2</div>
<div>mm mm i love u</div>
</div>
</div>
<div id=fbtn>
<div id=fbtn_mask></div>
<div id=fbtn_txt>
<div><A
href="http://blog.sina.com.cn/m/binghe2008"
target=_blank>博易天下</A></div>
<div><A href=" http://blog.sina.com.cn/m/binghe2008"
target=_blank>技术博客</A></div>
</div>
</div>
<div id=fbtn>
<div id=fbtn_mask></div>
<div id=fbtn_txt>
<div>G2</div>
<div>good evening</div>
</div>
</div>
<div id=fbtn>
<div id=fbtn_mask></div>
<div id=fbtn_txt>
<div>M1</div>
<div>my name is fireyy</div>
</div>
</div>
<div id=fbtn>
<div id=fbtn_mask></div>
<div id=fbtn_txt>
<div>M2</div>
<div>mm mm i love u</div>
</div>
</div>
<div id=fbtn>
</div>
<div id=fbtn>
</div>
<div id=fbtn>
</div>
<div id=fbtn>
</div>
<div id=fbtn>
</div>
<div id=fbtn>
</div>
<div id=fbtn>
</div>
<div id=fbtn>
</div>
<script>
var current=null;
var t=null;
for(var i=0;i<fbtn.length;i++){
fbtn_txt[i].style.posTop=-30;
fbtn_mask[i].style.posTop=-30;
fbtn[i].index=i;
fbtn[i].style.display="block";
fbtn[i].onmouseover=function(){
if(!current){
current=this;
domove(this.index);
}
else if(current!=this){
domove(current.index);
domove(this.index);
current=this;
}
}
fbtn[i].onmouseout=function(){
if(event.toElement==this.parentElement&t==this){
domove(this.index);
current=null;
}
}
}
function domove(num){
var o=fbtn_txt[num];
var m=fbtn_mask[num];
if(o.style.posTop<-60){
o.style.display="none";
var t=o.children[1].innerHTML;
o.children[1].innerHTML=o.children[0].innerHTML;
o.children[0].innerHTML=t;
o.style.posTop=-30;
o.style.display="block";
if(m.style.posTop>30)
m.style.posTop=-30;
else
m.style.posTop=0;
}
else{
m.style.posTop+=3;
o.style.posTop-=3;
setTimeout('domove('+num+')',15);
}
}
</script>
</body>
</html>
var current=null;
var t=null;
for(var i=0;i<fbtn.length;i++){
function domove(num){
</script>
</body>
</html>
代码说明:将上述代码粘贴到记事本修改好后,保存为xxx.html(网页的形式)的形势上传到网络硬盘 得到你的网址.
1.
width:150px;height:30px;是指导航栏的宽和高。 color:#B8B8A0
是菜单的颜色可以自己修改。
2. <div><A
href="http://blog.sina.com.cn/m/binghe2008"
target=_blank>博易天下</A></div>
<div><A href=" http://blog.sina.com.cn/m/binghe2008"
target=_blank>技术博客</A></div>
将上述的代码逐个换成自己的即可。
3.采用下面的代码调用:
<DIV><IFRAME style="WIDTH:
150px; HEIGHT: 240px" marginWidth=0 marginHeight=0
src="上传后你的网址" frameBorder=0
width=300 scrolling=no
height=200></IFRAME></DIV>
WIDTH: 150px; HEIGHT: 240px
是指调用后框架的宽和高,可自己调节。可以将上述代码采用绝对定位代码定位在任意位置!
效果如下:
转载注明出处:出自 :博易天下
前一篇:快速制做标题彩字
后一篇:新浪首发:连续不间断滚动的超链接