js下拉菜单在IE和fireworks浏览器都能正常运行
来源:互联网 发布:国外免费域名邮箱 编辑:程序博客网 时间:2024/04/29 17:07
在IE和fireworks浏览器都能正常运行
源码:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>仿QQ导航菜单-www.51windows.Net</title>
<style type="text/css">
.titleStyle{
background-color:#008800;color:#ffffff;border-top:1px solid #FFFFFF;font-size:9pt;cursor:hand;
}
.contentStyle{
background-color:#eeffee;color:blue;font-size:9pt;
}
a{
color:blue;
}
body{
font-size:9pt;
}
</style>
</head>
<body>
<script language="JavaScript">
<!--
var layerTop=20; //菜单顶边距
var layerLeft=30; //菜单左边距
var layerWidth=140; //菜单总宽
var titleHeight=20; //标题栏高度
var contentHeight=200; //内容区高度
var stepNo=10; //移动步数,数值越大移动越慢
var itemNo=0;runtimes=0;
document.write('<span id=itemsLayer style="position:absolute;overflow:hidden;border:1px solid #008800;left:'+layerLeft+';top:'+layerTop+';width:'+layerWidth+';">');
function addItem(itemTitle,itemContent){
itemHTML='<div id=item'+itemNo+' itemIndex='+itemNo+' style="position:relative;left:0;top:'+(-contentHeight*itemNo)+';width:'+layerWidth+';"><table width=100% cellspacing="0" cellpadding="0">'+
'<tr><td height='+titleHeight+' onclick=changeItem('+itemNo+') class="titleStyle" align=center>'+itemTitle+'</td></tr>'+
'<tr><td height='+contentHeight+' class="contentStyle">'+itemContent+'</td></tr></table></div>';
document.write(itemHTML);
itemNo++;
}
//添加菜单标题和内容,可任意多项,注意格式:
addItem('欢迎','<BR> 欢迎光临设计在线!');
addItem('网页陶吧','<center><a href="#">网页工具</a> <BR><BR><a href="#">技术平台</a> <BR><BR><a href="#">设计理念</a> <BR><BR><a href="#">更多</a></center>');
addItem('美工教室','<center><a href="#">平面设计 </a> <BR><BR><a href="#">三维空间</a> <BR><BR><a href="#">设计基础</a> <BR><BR><a href="#">更多..</a></center>');
addItem('Flash','<center><a href="#">基础教程</a> <BR><BR><a href="#">技巧运用</a> <BR><BR><a href="#">实例剖析</a> <BR><BR><a href="#">更多..</a></center>');
addItem('多媒体','<center><a href="#">DIRECTOR</a> <BR><BR><a href="#">Authorware</a> <BR><BR><a href="#">更多..</a></center>');
addItem('精品赏析','<center><a href="#">设计精品</a></center>');
addItem('精品赏析','<center><a href="#">设计精品</a></center>');
addItem('欢迎','<BR> 欢迎光临设计在线!');
addItem('网页陶吧','<center><a href="#">网页工具</a> <BR><BR><a href="#">技术平台</a> <BR><BR><a href="#">设计理念</a> <BR><BR><a href="#">更多</a></center>');
addItem('美工教室','<center><a href="#">平面设计 </a> <BR><BR><a href="#">三维空间</a> <BR><BR><a href="#">设计基础</a> <BR><BR><a href="#">更多..</a></center>');
addItem('Flash','<center><a href="#">基础教程</a> <BR><BR><a href="#">技巧运用</a> <BR><BR><a href="#">实例剖析</a> <BR><BR><a href="#">更多..</a></center>');
addItem('多媒体','<center><a href="#">DIRECTOR</a> <BR><BR><a href="#">Authorware</a> <BR><BR><a href="#">更多..</a></center>');
addItem('精品赏析','<center><a href="#">设计精品</a></center>');
addItem('精品赏析','<center><a href="#">设计精品</a></center>');
document.write('</span>')
document.all.itemsLayer.style.height=itemNo*titleHeight+contentHeight;
toItemIndex=itemNo-1;onItemIndex=itemNo-1;
function changeItem(clickItemIndex){
toItemIndex=clickItemIndex;
if(toItemIndex-onItemIndex>0) moveUp(); else moveDown();
runtimes++;
if(runtimes>=stepNo){
onItemIndex=toItemIndex;
runtimes=0;}
else
setTimeout("changeItem(toItemIndex)",10);
}
function moveUp(){
for(i=onItemIndex+1;i<=toItemIndex;i++)
eval('document.all.item'+i+'.style.top=parseInt(document.all.item'+i+'.style.top)-contentHeight/stepNo;');
}
function moveDown(){
for(i=onItemIndex;i>toItemIndex;i--)
eval('document.all.item'+i+'.style.top=parseInt(document.all.item'+i+'.style.top)+contentHeight/stepNo;');
}
changeItem(0);
//-->
</script>
</body>
</html>
<div style="position: absolute; top: 10; right: 10; width: 148; height: 18;cursor:hand">
<input type="button" name="Button" value="查看源代码" onClick=' window.location = "view-source:" + window.location.href'></div>
源码:
- js下拉菜单在IE和fireworks浏览器都能正常运行
- js在Firefox里面不运行,在IE浏览器里面运行正常
- 电脑网正常,除了IE之外其他浏览器都能正常上网,IE不能上网解决办法
- uploadify 在chrome浏览器下不能打开选择文件浏览框而在ff和ie下能正常打开
- 无论浏览者在IE选择什么编码,都能正常显示.
- IE不能运行js,在IE浏览器js代码失效,js不能运行了怎么办
- JS脚本在IE浏览器“开发者模式”正常,但正常使用时功能不成作用
- 修复jquery.cookie的bug,使其能在IE浏览器下正常工作
- js年月日下拉框IE,Firefox,Opera浏览器都可以使用
- js年月日下拉框IE,Firefox,Opera浏览器都可以使用
- ESB v6.6 如何在同一台机器安装两个Server,并都能正常运行?
- extjs中的JS代码在firefox可以正常运行,在IE中无法运行的方法。
- 在 IE 7 菜单不能正常显示
- 写能运行在IE和Firefox上的脚本
- jquery下拉菜单效果(超简洁实用,兼容IE和firefox等主流浏览器)
- 图片在IE浏览器不显示,在其他浏览器正常
- 解决IE不能上网,火狐能上网 谷歌和IE浏览器都上不了网只能火狐上怎么办?
- js在火狐和IE浏览器的差异
- 搜索引擎的十大秘密
- Google使用全攻略(一)
- Google使用全攻略(二)
- Texi2Html中文输出版
- 强烈建议每一个想成功的程序员读一读此文章
- js下拉菜单在IE和fireworks浏览器都能正常运行
- 懒人生活
- 如何用java实现在网页中保存html编辑器 编辑好的 html 文件?!(如blog里发文章的时候把要发表的内容以html文件的形式保存到服务器上?)
- VB拷贝文件
- Google使用全攻略(三)
- Google使用全攻略(四)
- google技巧
- 不求人?
- 如何选择合适的域名