参考代码如下:
<!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>
<title></title>
<script type="text/javascript" language="javascript" src="http://www.codefans.net/ajaxjs/jquery-1.4.2.min.js"></script>
<script type="text/javascript" language="javascript">
$(function() {
$("#right").click(function() {
var roll = $("<div></div>", { css: { position: "absolute", border: "solid 1px #999", left: "806px", top: "10px", height: "494px", width: "1px", background: "#fff"}}).appendTo($("#book").parent())
$(roll).animate({
left: "10px",
width: "398px"
}, 1000, function() {
$("#left").css({"background":"#fff"})
$(roll).fadeOut(300, function() {
$(roll).remove()
})
})
})
})
</script>
</head>
<body style="padding:5pxmargin:0">
<div id="book" style="width:797pxheight:494pxbackground:#cccborder:solid 6px #ccc">
<div id="left" style="width:398pxheight:494pxfloat:leftbackground:url(http://www.codefans.net/jscss/demoimg/201011/PLh.png) no-repeat top leftcursor:pointer"></div>
<div id="right" style="width:398pxheight:494pxfloat:leftbackground:#fffcursor:pointermargin-left:1pxtext-align:right"><p style="margin-top:470pxfont-size:12pxcolor:#999">点这翻页 </p></div>
</div>
</body>
</html>
var img = document.getElementById('image')//获得id为image元素var n = Number(img.title) + n//定义一个变量,值为元素title+自己的值,这里title必须为数字,否则抛出异常,Number()是把字符串类型的数字转为Number类型
if(n <1) n = 4//如果n<1 , n=4
if(n >4) n = 1//如果n>4,n=1 ,这里是一个循环,应该是点到最后一张图片后显示第一张图片
img.src = 'image/'+n+'.jpg'//imgage是文件夹名,n.jpg是文件夹下图片名
img.title = n//改变元素title为n
var a = img.parentNode//定义img的上级节点,应该是一个超链接(<a href=""></a>)
a.href = img.src//为a标记添加href
return false//返回false
<div id="jy_con2" class="left_box" style="display:black" ><ul>
<li><a href="#">1</a></li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>7</li>
<li>8</li>
<li>9</li>
<li>10</li>
<li>11</li>
<li>12</li>
<li>13</li>
<li>14</li>
<li>15</li>
<li>16</li>
<li>17</li>
<li><a href="#">18</a></li>
<li>19</li>
<li>20</li>
<li>21</li>
<li>22</li>
<li>23</li>
<li>24</li>
<li>25</li>
</ul>
</div>
<p></p>
<div id="pages" style="font-size:14px"></div>
<script language="javascript">
var obj = document.getElementById("jy_con2")
var pages = document.getElementById("pages")
var lis =obj.document.getElementsByTagName("li")
var items =11
window.onload = function () {
var allpages = Math.ceil(lis.length/items)
pages.innerHTML = "<b>共" + allpages + "页</b>"
showpart(1)
for (var i = 1i <= allpagesi++) {
pages.innerHTML += "<a href=\"javascript:showpart('" + i + "')\">第" + i + "页</a>"
}
}
function showpart(x) {
for(var i=0i<lis.lengthi++)
{
lis[i].style.display="none"
}
for(var j=(x-1)*itemsj<x*11&&j<lis.lengthj++)
{
lis[j].style.display="block"
}
}
</script>
<!--眼花了,帮你做个改进版-->