首页技术最简单的js代码(js代码是什么意思)

最简单的js代码(js代码是什么意思)

编程之家2026-06-09724次浏览

大家好,最简单的js代码相信很多的网友都不是很明白,包括js代码是什么意思也是一样,不过没有关系,接下来就来为大家分享关于最简单的js代码和js代码是什么意思的一些知识点,大家可以关注收藏,免得下次来找不到哦,下面我们开始吧!

最简单的js代码(js代码是什么意思)

简单的js代码求注释,就几句话

(function(index){

//处理代码

})(i);

楼主一定对上面的代码是怎么执行的完全不明白。在弄清楚为什么去掉i后就没有效果,你必须得先知道这个i到底为什么不能去掉,这种写法又到底是怎么回事。

其实这是一种函数立即调用的写法。也就是定义一个匿名函数,然后立即就执行这个函数。这样的写法相当于:

function tmpName(index){

最简单的js代码(js代码是什么意思)

//处理代码

}

tmpName(i);再接近一点的写法如下:

var fn= function(index){

//处理代码

}

最简单的js代码(js代码是什么意思)

//函数调用

fn(i);你把上面的fn换成function(index){},是不是就是和你的那种写法一样了?只不过换后的函数省去了函数名。

很明显,index是形参,而i是在调用时传递的实参。如果不穿进去一个i,那就相当index参数没有了。这样的话,这个函数中用到的index的值就是null。试想,mDD[index]就变成了mDD[null],数组访问可以这样吗?这样不就出异常了吗?也是因此,不传进去i,会导致异常,会出错。

求个简单javascript代码 谢谢,网站菜单功能

不用说自己菜不菜的,能有这个学习的精神已经很值得鼓励了

呵呵,下面,我来给你介绍几个网站常见的菜单

第一个:仿网易的滑动门导航菜单

<html xmlns="">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312"/>

<title>仿网易的滑动门技术,用DIV+CSS技术实现</title>

<style type="text/css">

<!--

#header{

background-color:#F8F4EF;

height: 200px;

width: 400px;

margin: 0px;

padding: 0px;

border: 1px solid#ECE1D5;

font-family:"宋体";

font-size: 12px;

}

#menu{

margin: 0px;

padding: 0px;

list-style-type: none;

}

#menu li{

display: block;

width: 100px;

text-align: center;

float: left;

margin: 0px;

padding-top: 0.2em;

padding-right: 0px;

padding-bottom: 0.2em;

padding-left: 0px;

cursor: hand;

}

.sec1{ background-color:#FFFFCC;}

.sec2{ background-color:#00CCFF;}

.block{ display: block;}

.unblock{ display: none;}

-->

</style>

</head>

<body>

<script language=javascript>

function secBoard(n)

{

for(i=0;i<menu.childNodes.length;i++)

menu.childNodes[i].className="sec1";

menu.childNodes[n].className="sec2";

for(i=0;i<main.childNodes.length;i++)

main.childNodes[i].style.display="none";

main.childNodes[n].style.display="block";

}

</script>

<div id="header">

<ul id="menu">

<li onMouseOver="secBoard(0)" class="sec2">最新新闻</li>

<li onMouseOver="secBoard(1)" class="sec1">最新文章</li>

<li onMouseOver="secBoard(2)" class="sec1">最新日志</li>

<li onMouseOver="secBoard(3)" class="sec1">论坛新帖</li>

</ul>

<!--内容显示区域-->

<ul id="main">

<li class="block">第一个内容</li>

<li class="unblock">第二个内容</li>

<li class="unblock">第三个内容</li>

<li class="unblock">第四个内容</li>

</ul>

<!--内容显示区域-->

</div>

</body>

</html>

这里基本上是使用Css与Div的结合,在整个布局中已层为单位,实行滑动菜单的是一个javascript脚本函数,调用就可以了,看不懂不要紧,日渐积累才是重要

第二个:经典实用的触发型导航(这是鼠标单击事件控制)

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<title>网页特效代码|JsCode.CN|---经典实用的触发型导航菜单</title>

</head>

<body>

<STYLE type=text/css>.sec1{

BORDER-RIGHT: gray 1px solid; BORDER-TOP:

#ffffff 1px solid; BORDER-LEFT:#ffffff 1px

solid; CURSOR: hand; COLOR:#000000; BORDER-

BOTTOM:#ffffff 1px solid; BACKGROUND-COLOR:

#eeeeee

}

.sec2{

BORDER-RIGHT: gray 1px solid; BORDER-TOP:

#ffffff 1px solid; FONT-WEIGHT: bold; BORDER-

LEFT:#ffffff 1px solid; CURSOR: hand; COLOR:

#000000; BACKGROUND-COLOR:#d4d0c8

}

.main_tab{

BORDER-RIGHT: gray 1px solid; BORDER-

LEFT:#ffffff 1px solid; COLOR:#000000; BORDER-

BOTTOM: gray 1px solid; BACKGROUND-COLOR:#d4d0c8

}

</STYLE>

<!--JavaScript部分-->

<SCRIPT language=javascript>

function secBoard(n)

{

for(i=0;i<secTable.cells.length;i++)

secTable.cells

[i].className="sec1";

secTable.cells[n].className="sec2";

for(i=0;i<mainTable.tBodies.length;i++)

mainTable.tBodies

[i].style.display="none";

mainTable.tBodies

[n].style.display="block";

}

</SCRIPT>

<!--HTML部分-->

<TABLE id=secTable cellSpacing=0 cellPadding=0 width=549 border=0>

<TBODY>

<TR align=middle height=20>

<TD class=sec2 onclick=secBoard(0) width="10%">关于TBODY标记</TD>

<TD class=sec1 onclick=secBoard(1) width="10%">关于cells集合</TD>

<TD class=sec1 onclick=secBoard(2) width="10%">关于tBodies集合</TD>

<TD class=sec1 onclick=secBoard(3) width="10%">关于display属性</TD></TR></TBODY></TABLE>

<TABLE class=main_tab id=mainTable height=240 cellSpacing=0 cellPadding=0 width=549 border=0><!--关于TBODY标记-->

<TBODY style="DISPLAY: block">

<TR>

<TD vAlign=top align=middle><BR><BR>

<TABLE cellSpacing=0 cellPadding=0 width=490 border=0>

<TBODY>

<TR>

<TD>指定行做为表体。

<BR>注释:TBODY要素是块要素,并且需要结束标

签。<BR>即使如果表格没有显式定义TBODY

要素,该要素也提供给所有表。<BR><BR>

参考:《动态HTML参考和开发应用大全》(人民邮电出

版社

Microsoft Corporation著

北京华中兴业科技发展有限公司

译)

<BR><BR></TD></TR></TB

ODY></TABLE></TD></TR></T

BODY><!--关于cells集合-->

<TBODY style="DISPLAY:

none">

<TR>

<TD vAlign=top

align=middle><BR><BR>

<TABLE cellSpacing=0

cellPadding=0 width=490 border=0>

<TBODY>

<TR>

<TD>检索表行或者整个

表中所有单元格的集合。<BR>应用于TR、TABLE。

<BR><BR>参考:《动态HTML参考和开发应

用大全》(人民邮电出版社

Microsoft Corporation著

北京华中兴业科技发展有限公司

译)

<BR><BR></TD></TR></TB

ODY></TABLE></TD></TR></T

BODY><!--关于tBodies集合-->

<TBODY style="DISPLAY:

none">

<TR>

<TD vAlign=top

align=middle><BR><BR>

<TABLE cellSpacing=0

cellPadding=0 width=490 border=0>

<TBODY>

<TR>

<TD>检索表中所有TBODY

对象的集合。对象在该集合中按照HTML源顺序排列。

<BR>应用于TABLE。<BR><BR>参考:

《动态HTML参考和开发应用大全》(人民邮电出版社

Microsoft Corporation著

北京华中兴业科技发展有限公司

译)

<BR><BR></TD></TR></TB

ODY></TABLE></TD></TR></T

BODY><!--关于display属性-->

<TBODY style="DISPLAY:

none">

<TR>

<TD vAlign=top

align=middle><BR><BR>

<TABLE cellSpacing=0

cellPadding=0 width=490 border=0>

<TBODY>

<TR>

<TD>设置或者检索对象

是否被提供。<BR>可能的值为block、none、

inline、list-item、table-header-group、table-

footer-group。<BR>该特性可读写,块要素默认

值为block,内联要素默认值为inline;层叠样式表

(CSS)属性不可继承。<BR><BR>参考:《

动态HTML参考和开发应用大全》(人民邮电出版社

Microsoft Corporation著

北京华中兴业科技发展有限公司译)

<BR><BR><A

rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="" target=_blank>点击此处

</A>可参阅微软<A rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="" target=_blank>MSDN在线</A>上的解释。

</TD></TR></TBODY></TABLE>

;</TD></TR></TBODY></TABLE&g

t;</body>

</html>

这里跟上面不同的区别在与这是鼠标移动和滑动的事件区别!

第三个:仿拍拍的切换效果菜单(里面的图片是我放上去的,所以会看不到图片的,呵呵继续)

<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""">

<html xmlns="" lang="zh-CN">

<head>

<meta http-equiv="Content-Language" content="zh-cn"/>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312"/>

<meta name="robots" content="all"/>

<title>网页特效|网页特效代码(JsHtml.cn)---仿拍拍paipai.com首页产品图片随机轮显切换效果</title><style>

body{font-size:12px}

img{border:0px}

#sale{right:206px;top:0;width:260px;background:#fff}

#saleTitle{text-align:right;padding-top:5px;padding-right:5px;width:255px;height:20px;background:url("images/saleTitle.gif") no-repeat}

#saleList{margin-top:5px}

#saleList.saleTwo{height:108px;background:url("images/salelineH.gif") bottom repeat-x;}

#saleList a{display:block;height:108px;width:86px;text-align:center;float:left;overflow:hidden}

#saleList a.saleItem{background:url("images/salelineV.gif") right repeat-y;}

#saleList a img{margin:5px 0}

#saleList a:hover{background-color:#EBFFC5}

</style>

<script type="text/javascript">

rnd.today=new Date();

rnd.seed=rnd.today.getTime();

function rnd(){

rnd.seed=(rnd.seed*9301+49297)% 233280;

return rnd.seed/(233280.0);

}

function rand(number){

return Math.ceil(rnd()*number)-1;

}

function nextSale(order){

if(order=="up") saleNum--;

else saleNum++;

if(saleNum>2) saleNum=0

else if(saleNum<0) saleNum=2;

//alert(saleNum);

for(i=0;i<3;i++)

document.getElementById("saleList"+i).style.display="none";

document.getElementById("saleList"+saleNum).style.display="";

}

</script>

</head>

<body>

<div id="sale" class="absolute overflow">

<div id="saleTitle" class="absolute">

<a rel="external nofollow" href="javascript:nextSale('up')" title="点击到上一屏">

<img src="images/saleFore.gif" hspace="4" onmouseover="this.src='images/saleForeOver.gif'" onmouseout="this.src='images/saleFore.gif'"/></a><a rel="external nofollow" href="javascript:nextSale('down')" title="点击到下一屏"><img src="images/saleNext.gif" onmouseover="this.src='images/saleNextOver.gif'" onmouseout="this.src='images/saleNext.gif'"/></a></div>

<div class="overflow" style="height:330px" id="saleList">

<script type="text/javascript">var saleNum=rand(3);</script>

<div id="saleList0" style="display:none">

<div class="saleTwo">

<a class="saleItem" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="" target="_blank">

<div>

<img alt="圣诞浪漫饰品超级大促" src="/jsimages/UploadFiles_3321/200804/20080423085515804.jpg" width="65" height="65"/></div>

<div>

圣诞浪漫饰品<br/>

超级大促</div>

</a>

<a class="saleItem" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="" target="_blank">

<div>

<img alt="摄像头集结号给你新的感觉" src="/jsimages/UploadFiles_3321/200804/20080423085516472.jpg" width="65" height="65"/></div>

<div>

摄像头集结号<br/>

给你新的感觉</div>

</a><a rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="" target="_blank">

<div>

<img alt="好感度提升韩版娃娃装" src="/jsimages/UploadFiles_3321/200804/20080423085516162.jpg" width="65" height="65"/></div>

<div>

好感度提升<br/>

韩版娃娃装</div>

</a></div>

<div class="saleTwo">

<a class="saleItem" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="" target="_blank">

<div>

<img alt="复古牛仔外套特惠119元起" src="/jsimages/UploadFiles_3321/200804/20080423085516293.jpg" width="65" height="65"/></div>

<div>

复古牛仔外套<br/>

特惠119元起</div>

</a>

<a class="saleItem" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="" target="_blank">

<div>

<img alt="圣诞拍拍特供运动服3折" src="/jsimages/UploadFiles_3321/200804/20080423085516802.jpg" width="65" height="65"/></div>

<div>

圣诞拍拍特供<br/>

运动服3折</div>

</a><a rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="" target="_blank">

<div>

<img alt="摄像头集结号给你新的感觉" src="/jsimages/UploadFiles_3321/200804/20080423085516472.jpg" width="65" height="65"/></div>

<div>

摄像头集结号<br/>

给你新的感觉</div>

</a></div>

<div>

<a class="saleItem" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="" target="_blank">

<div>

<img alt="圣诞拍拍特供电脑周边4折" src="/jsimages/UploadFiles_3321/200804/20080423085516530.jpg" width="65" height="65"/></div>

<div>

圣诞拍拍特供<br/>

电脑周边4折</div>

</a>

<a class="saleItem" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="" target="_blank">

<div>

<img alt="party扮靓甜美腮红" src="/jsimages/UploadFiles_3321/200804/20080423085516658.jpg" width="65" width="65" height="65"/></div>

<div>

party扮靓<br/>

甜美腮红</div>

</a><a rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="" target="_blank">

<div>

<img alt="好感度提升韩版娃娃装" src="/jsimages/UploadFiles_3321/200804/20080423085516162.jpg" width="65" height="65"/></div>

<div>

好感度提升<br/>

韩版娃娃装</div>

</a></div>

</div>

<div id="saleList1" style="display:none">

<div class="saleTwo">

<a class="saleItem" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="" target="_blank">

<div>

<img alt="新奇好玩便宜尽在网游频道" src="/jsimages/UploadFiles_3321/200804/20080423085516612.jpg" width="65" height="65"/></div>

<div>

新奇好玩便宜<br/>

尽在网游频道</div>

</a>

<a class="saleItem" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="" target="_blank">

<div>

<img alt="展现高贵气质骑士系马靴" src="/jsimages/UploadFiles_3321/200804/20080423085516202.jpg" width="65" height="65"/></div>

<div>

展现高贵气质<br/>

骑士系马靴</div>

</a><a rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="" target="_blank">

<div>

<img alt="摄像头集结号给你新的感觉" src="/jsimages/UploadFiles_3321/200804/20080423085516472.jpg" width="65" height="65"/></div>

<div>

摄像头集结号<br/>

给你新的感觉</div>

</a></div>

<div class="saleTwo">

<a class="saleItem" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="" target="_blank">

<div>

<img alt="永不过时条纹毛衣" src="/jsimages/UploadFiles_3321/200804/20080423085516984.jpg" width="65" height="65"/></div>

<div>

永不过时<br/>

条纹毛衣</div>

</a>

<a class="saleItem" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="" target="_blank">

<div>

<img alt="圣诞拍拍特供运动鞋2折" src="/jsimages/UploadFiles_3321/200804/20080423085516651.jpg" width="65" height="65"/></div>

<div>

圣诞拍拍特供<br/>

运动鞋2折</div>

</a><a rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="" target="_blank">

<div>

<img alt="好感度提升韩版娃娃装" src="/jsimages/UploadFiles_3321/200804/20080423085516162.jpg" width="65" height="65"/></div>

<div>

好感度提升<br/>

韩版娃娃装</div>

</a></div>

<div>

<a class="saleItem" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="" target="_blank">

<div>

<img alt="精简唯美索爱K630" src="/jsimages/UploadFiles_3321/200804/20080423085516302.jpg" width="65" height="65"/></div>

<div>

精简唯美<br/>

索爱K630</div>

</a>

<a class="saleItem" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="" target="_blank">

<div>

<img alt="原装瑞士军刀精选" src="/jsimages/UploadFiles_3321/200804/20080423085516549.jpg" width="65" width="65" height="65"/></div>

<div>

原装瑞士军刀<br/>

精选</div>

</a><a rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="" target="_blank">

<div>

<img alt="超薄机身索爱W880" src="/jsimages/UploadFiles_3321/200804/20080423085516711.jpg" width="65" height="65"/></div>

<div>

超薄机身<br/>

索爱W880</div>

</a></div>

</div>

<div id="saleList2" style="display:none">

<div class="saleTwo">

<a class="saleItem" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="" target="_blank">

<div>

<img alt="各就各味秋冬饮食计划" src="/jsimages/UploadFiles_3321/200804/20080423085516704.jpg&type=3" width="65" height="65"/></div>

<div>

各就各味<br/>

秋冬饮食计划</div>

</a><a rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="" target="_blank">

<div>

<img alt="好感度提升韩版娃娃装" src="/jsimages/UploadFiles_3321/200804/20080423085516162.jpg" width="65" height="65"/></div>

<div>

好感度提升<br/>

韩版娃娃装</div>

</a></div>

<div class="saleTwo">

<a class="saleItem" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="" target="_blank">

<div>

<img alt="圣诞拍拍特供随身视听5折" src="/jsimages/UploadFiles_3321/200804/20080423085516375.jpg" width="65" height="65"/></div>

<div>

圣诞拍拍特供<br/>

随身视听5折</div>

</a><a rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="" target="_blank">

<div>

<img alt="超薄机身索爱W880" src="/jsimages/UploadFiles_3321/200804/20080423085516711.jpg" width="65" height="65"/></div>

<div>

超薄机身<br/>

索爱W880</div>

</a></div>

<div>

<a class="saleItem" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="" target="_blank">

<div>

<img alt="我爱我家家居大抢购" src="/jsimages/UploadFiles_3321/200804/20080423085516954.jpg" width="65" height="65"/></div>

<div>

我爱我家<br/>

家居大抢购</div>

</a><a rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="" target="_blank">

<div>

<img alt="超值彩妆套装变身派对女王" src="/jsimages/UploadFiles_3321/200804/20080423085516919.jpg" width="65" width="65" height="65"/></div>

<div>

超值彩妆套装<br/>

变身派对女王</div>

</a></div>

</div>

</div>

</div>

<script type="text/javascript">document.getElementById("saleList"+saleNum).style.display="";</script>

<p></p>

<p>更多网页特效代码尽在<a rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="">网页特效代码</a></p>

</body>

</html>

这个仿拍拍基本上就是2层放图片,但用起来的效果还是可以的,如果不喜欢我还有下面呢,慢慢学,总会看懂的(最重要的还是Css哦)

这个主要就是让层实现隐藏我觉得这个在层使用方面还是好的

从总体上看,在实现层与层之间的交互,在其代码我觉得你有必要去认真看下!

以上是我介绍额度菜单,虽然不是很强大,但是却很使用,而且在J2EE中

菜单基本上是一个假象,都是用层与Css之间的特效做出来的!

学会了层的具体应用,我相信你也可以有自己特色的菜单的

那我祝你好运咯!!加油!!

如何优化js代码

一、让代码简洁:一些简略的表达方式也会产生很好的优化\x0d\x0aeg:x=x+1;在不影响功能的情况下可以简写为x++;\x0d\x0a二、变量名方法名尽量在不影响语意的情况下简单。(可以选择首字母命名)\x0d\x0aeg:定义数组的长度可以取名为:ArrLen而不需要取为ArrayLength。\x0d\x0a三、关于JS的循环,循环是一种常用的流程控制。\x0d\x0aJS提供了三种循环:for(;;)、while()、for(in)。在这三种循环中for(in)的效率最差,因为它需要查询Hash键,因此应尽量少用for(in)循环,for(;;)、while()循环的性能基本持平。当然,推荐使用for循环,如果循环变量递增或递减,不要单独对循环变量赋值,而应该使用嵌套的++或_运算符。\x0d\x0a四、如果需要遍历数组,应该先缓存数组长度,将数组长度放入局部变量中,避免多次查询数组长度。\x0d\x0a因为我们常常要根据字符串、数组的长度进行循环,而通常这个长度是不变的,比如每次查询a.length,就要额外进行一个操作,而预先把var len=a.length,则就少了一次查询。\x0d\x0a五、尽量选用局部变量而不是全局变量。\x0d\x0a局部变量的访问速度要比全局变量的访问速度更快,因为全局变量其实是window对象的成员,而局部变量是放在函数的栈里的。\x0d\x0a六、尽量少使用eval。\x0d\x0a每次使用eval需要消耗大量时间,这时候使用JS所支持的闭包可以实现函数模板。\x0d\x0a七、减少对象查找\x0d\x0a因为JavaScript的解释性,所以a.b.c.d.e,需要进行至少4次查询操作,先检查a再检查a中的b,再检查b中的c,如此往下。所以如果这样的表达式重复出现,只要可能,应该尽量少出现这样的表达式,可以利用局部变量,把它放入一个临时的地方进行查询。\x0d\x0a八、字符串连接。\x0d\x0a如果是追加字符串,最好使用s+=anotherStr操作,而不是要使用s=s+anotherStr。\x0d\x0a如果要连接多个字符串,应该少使用+=,如s+=a;s+=b;s+=c;应该写成s+=a+ b+ c;\x0d\x0a而如果是收集字符串,比如多次对同一个字符串进行+=操作的话,最好使用一个缓存。怎么用呢?使用JavaScript数组来收集,最后使用join方法连接起来,如下\x0d\x0avar buf= new Array();for(var i= 0; i String()>.toString()> new String() \x0d\x0a尽量使用编译时就能使用的内部操作要比运行时使用的用户操作要快。\x0d\x0aString()属于内部函数,所以速度很快,而.toString()要查询原型中的函数,所以速度逊色一些,new String()用于返回一个精确的副本。\x0d\x0a2.浮点数转换成整型,这个更容易出错,很多人喜欢使用parseInt(),其实parseInt()是用于将字符串转换成数字,而不是浮点数和整型之间的转换,我们应该使用Math.floor()或者Math.round()。Math是内部对象,所以Math.floor()其实并没有多少查询方法和调用的时间,速度是最快的。\x0d\x0a3.对于自定义的对象,如果定义了toString()方法来进行类型转换的话,推荐显式调用toString(),因为内部的操作在尝试所有可能性之后,会尝试对象的toString()方法尝试能否转化为String,所以直接调用这个方法效率会更高\x0d\x0a十、尽量作用JSON格式来创建对象,而不是var obj=new Object()方法。\x0d\x0a因为前者是直接复制,而后者需要调用构造器,因而前者的性能更好。\x0d\x0a十一、当需要使用数组时,也尽量使用JSON格式的语法,\x0d\x0a使用JSON格式的语法即直接使用如下语法定义数组:[parrm,param,param...],而不是采用new Array(parrm,param,param...)这种语法。因为使用JSON格式的语法是引擎直接解释的。而后者则需要调用Array的构造器。\x0d\x0a十二、对字符串进行循环操作,例如替换、查找,就使用正则表达式。\x0d\x0a因为JS的循环速度比较慢,而正则表达式的操作是用C写成的API,性能比较好。\x0d\x0a十三、插入HTML\x0d\x0a很多人喜欢在JavaScript中使用document.write来给页面生成内容。事实上这样的效率较低,如果需要直接插入HTML,可以找一个容器元素,比如指定一个div或者span,并设置他们的innerHTML来将自己的HTML代码插入到页面中。\x0d\x0a十四、对象查询\x0d\x0a使用[“”]查询要比.items()更快\x0d\x0a十五、定时器\x0d\x0a如果针对的是不断运行的代码,不应该使用setTimeout,而应该是用setInterval。setTimeout每次要重新设置一个定时器。\x0d\x0a十六、尽量减少DOM调用\x0d\x0a在Web开发中,JavaScript的一个很重要的作用就是对DOM进行操作。可是对DOM的操作是非常昂贵的,因为这会导致浏览器执行回流(reflow)操作。我们应该尽可能的减少DOM操作。

END,本文到此结束,如果可以帮助到大家,还望关注本站哦!

ai兄弟人工智能软件下载,Ai是什么软件有什么用百度ai修图软件 十大ai修图软件