js实现翻页效果,求助
- JScript code
<!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>//PicNum=图片的数量//Horizontal=横向列数//Vertical=向下行数//Width=图片宽度//Heigh=图片告诉function addRow(PicNum,Horizontal,Vertical,Width,Height) {var MyTable = document.getElementById("MyTable");var MyTbody = document.getElementById("MyTbody");TbodyTotal=1for (i=1;i<=Horizontal;i++){ MyTR = document.createElement("tr"); MyTR.setAttribute("id","tr"); for (j=1;j<=Vertical;j++){ MyTD = document.createElement("td"); MyTD.align = "center"; MyImg = document.createElement("img"); MyImg.height = Width; MyImg.width = Height; Mya = document.createElement("A"); Mya.href="http://www.163.com"; Mya.appendChild(MyImg); MyTD.appendChild(Mya); MyBr = document.createElement("br"); MyTD.appendChild(MyBr); MyDiv1 = document.createElement("div"); MyTxt = document.createTextNode("价格"); MyTD.appendChild(MyTxt); MyTD.appendChild(MyDiv1); MyDiv2 = document.createElement("div"); var a = document.createElement("a"); a.href = "#"; a.innerHTML = "**产品名**"; MyTD.appendChild(a); MyTD.appendChild(MyDiv2); MyTR.appendChild(MyTD); TbodyTotal++; } MyTbody.appendChild(MyTR); }}</script></head><body><input type="button" value="生成" onClick="addRow(50,3,5,120,120)"><p> </p><table border="1" cellspacing="2" cellpadding="2" id="MyTable"><tbody id="MyTbody"></tbody></table></body></html>楼主刚接触js,并要求在短时间完成一件任务。现在遇到了js中翻页的问题。调用addRow(50,3,5,120,120)函数,我想显示50张图片,但是一个页面只能显示15(参数二乘以参数三)张,这里应该如何实现“上一页”“下一页”那种效果呢,麻烦各位了
[解决办法]
不清楚你说的什么,你的图片在那放着?以什么方式读取,一次读50个图片?,要考虑显示器大小,你在csdn,里下载一个看看吧。