非哥 下面代码一加上就会让点击菜单切换的功能失效

plglenn28 2009-12-16 08:47:09


下面代码一加上就会让点击菜单切换的功能失效
       
<%-- -------------------begin--%>


<script>
function $(id) {
return document.getElementById(id);
}
var pageSize = 5;
var currentPageIndex = 0;
var pageCount = 0;

function changeSrc(src, num) {
$('spanCurrent').innerHTML = currentPageIndex * pageSize + 1 + num;
$('imgO').src = src.replace('_100.jpg', '.jpg');
}

function changePageIndex(str) {

if ((str == 'p' && currentPageIndex < 1) || (str == 'n' && currentPageIndex > pageCount - 2)) {
return;
}
if (str == 'p') {
currentPageIndex = currentPageIndex < 1 ? 1 : currentPageIndex - 1;
}
else {
if (typeof imgArray != 'undefined' && imgArray instanceof Array) {
currentPageIndex = currentPageIndex > pageCount - 2 ? pageCount : currentPageIndex + 1;
}
}
init();
}
imgArray = new Array();
imgArray.push('http://photo.100du.com/store_album/10/1d/3e/23380_100.jpg');
imgArray.push('http://photo.100du.com/store_album/fe/c9/eb/23379_100.jpg');
imgArray.push('http://photo.100du.com/store_album/02/26/aa/23378_100.jpg');
imgArray.push('http://photo.100du.com/store_album/dd/e5/af/23377_100.jpg');
imgArray.push('http://photo.100du.com/store_album/0e/ad/71/23376_100.jpg');
imgArray.push('http://photo.100du.com/store_album/43/51/43/23397_100.jpg');
imgArray.push('http://photo.100du.com/store_album/22/9b/98/23396_100.jpg');
imgArray.push('http://photo.100du.com/store_album/64/1e/0c/23395_100.jpg');
imgArray.push('http://photo.100du.com/store_album/e8/36/b5/23394_100.jpg');
imgArray.push('http://photo.100du.com/store_album/3c/79/e6/23393_100.jpg');
imgArray.push('http://photo.100du.com/store_album/c0/f3/a9/23383_100.jpg');
imgArray.push('http://photo.100du.com/store_album/d5/a1/46/23382_100.jpg');
imgArray.push('http://photo.100du.com/store_album/eb/72/d0/23381_100.jpg');
</script>
<script>
function init() {
if (typeof imgArray != 'undefined' && imgArray instanceof Array) {

//为了能看到效果,可以取消
$('imgOne').src = '';
$('imgTwo').src = '';
$('imgThree').src = '';
$('imgFour').src = '';
$('imgFive').src = '';


$('imgOne').src = imgArray[currentPageIndex * pageSize];

if (currentPageIndex * pageSize + 1 >= imgArray.length) {
$('imgTwo').style.display = "none";
}
else {
$('imgTwo').style.display = "";
$('imgTwo').src = imgArray[currentPageIndex * pageSize + 1];
}

if (currentPageIndex * pageSize + 2 >= imgArray.length) {
$('imgThree').style.display = "none";
}
else {
$('imgThree').style.display = "";
$('imgThree').src = imgArray[currentPageIndex * pageSize + 2];
}

if (currentPageIndex * pageSize + 3 >= imgArray.length) {
$('imgFour').style.display = "none";
}
else {
$('imgFour').style.display = "";
$('imgFour').src = imgArray[currentPageIndex * pageSize + 3];
}

if (currentPageIndex * pageSize + 4 >= imgArray.length) {
$('imgFive').style.display = "none";
}
else {
$('imgFive').style.display = "";
$('imgFive').src = imgArray[currentPageIndex * pageSize + 4];
}

$('spanLength').innerHTML = imgArray.length;
}
} //end function init


init();

if (typeof imgArray != 'undefined' && imgArray instanceof Array) {
$('imgO').src = $('imgOne').src.replace('_100.jpg', '.jpg');
pageCount = imgArray.length % pageSize == 0 ? imgArray.length / pageSize : Math.floor(imgArray.length / pageSize) + 1;
$('spanCurrent').innerHTML = 1;
}

</script>
<%-- -------------------end--%>
...全文
259 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
plglenn28 2009-12-16
  • 打赏
  • 举报
回复
我刚才得到 3f4f 知道,把$ 换成了$$ ok!!!!
plglenn28 2009-12-16
  • 打赏
  • 举报
回复
plglenn28 2009-12-16
  • 打赏
  • 举报
回复



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0041)http://food.100du.com/album/1208412653182 -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<title>常胜鲍鱼店_相册_100du享乐网_北京站</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta content="常胜鲍鱼地处繁华的CBD商圈,可承接婚宴、朋友聚餐、家庭晚宴、商务会议、宴请及家宴外送服务,多款午晚优惠套餐,可根据宾客不同需求设计菜单,尊贵之情,味然其中!"
name="description">

<script src="biz_photo.files/album.js" type="text/javascript"></script>

<link href="biz_photo.files/fieldgroup.css" rel="stylesheet" type="text/css" />
<link href="biz_photo.files/all.css" rel="stylesheet" type="text/css" />
<link href="biz_photo.files/all_new.css" rel="stylesheet" type="text/css" />

<script src="biz_photo.files/browsercopy.js" type="text/javascript"></script>
wuyq11 2009-12-16
  • 打赏
  • 举报
回复
是否存在代码冲突
wiki14 2009-12-16
  • 打赏
  • 举报
回复
菜单切换的功能也是JS么?
是不是两个JS有冲突?
plglenn28 2009-12-16
  • 打赏
  • 举报
回复
我知道,借非之名拉贴
xupeihuagudulei 2009-12-16
  • 打赏
  • 举报
回复
楼主,非哥晚上从来都不在。

62,263

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧