教程集 www.jiaochengji.com
教程集 >  jQuery  >  jquery 教程  >  正文 基于jquery的超简单上下翻

基于jquery的超简单上下翻

发布时间:2013-08-19   编辑:jiaochengji.com
简单上下翻,函数,获取元素。
简单上下翻,函数,获取元素。
复制代码 代码如下:

<html>
<head>
<title>超简单上下翻</title>
<script type="text/javascript" src="js/jquery.js"></script>
</head>
<body>
简单上下翻,函数
<script type="text/javascript">
function UpDown(What) {
var aList = $("#tab a");
var oldnode = aList.get(0);
/*
*获取最后一个元素三种方法
*/
newnode = aList[aList.length - 1];
newnode = aList.get(aList.length - 1);
newnode = $("#tab a:last");
if (What == "up") return $(oldnode).before(newnode);
$(newnode).after(oldnode)
}
</script>
<div id="tab">
<a href='#'> a </a><a href='#'> b </a><a href='#'> c </a><a href='#'> d </a><a href='#'> e </a><a href='#'> f </a></div>
<a href='#' onclick="UpDown('up')">上一个</a>
<a href='#' onclick="UpDown()">下一个</a>
</body>
</html>

您可能感兴趣的文章:
基于jquery的超简单上下翻
分享几个超级震憾的图片特效
jquery 入门教程 [翻译] 推荐
jQuery Gird
jQuery对话框插件 ThickBox
CSS3使用Animate.css制作超炫的动画效果
Web开发者必备的12款超赞jQuery插件
可以显示单图片,多图片ajax请求的ThickBox3.1类下载
jQuery Lightbox
jQuery 标题的自动翻转实现代码

[关闭]
~ ~