<head>
<title>images 集合显示一个幻灯片</title>
<script type="text/javascript">
var currentPhoto=0;
var pics=new Array();
for(var i=0;i<5;i++){
pics[i]=new Image();
}
pics[0].src="../images/flower.bmp";
pics[1].src="../images/girls.jpg";
pics[2].src="../images/likes.jpg";
pics[3].src="../images/moon.jpg";
pics[4].src="../images/vehicle.jpg";
function changePhoto(photo){
document.images[0].src=pics[photo].src;
}
function nextPic(){
currentPhoto++;
if((currentPhoto<pics.length){
changePhoto(currentPhoto);
}else{
alert("At the end of the photo list");
}
}
function prevPic(){
if(pics.length>0){
currentPhoto--;
changePhoto(currentPhoto);
}else{
alert("At the beginning of the photo list");
}
}
</script>
</head>
<body> <img src="../images/girls.jpg" />
<p>
<a href="" onclick="nextPic();return false">Next picture</a><br />
<a href="" onclick="prevPic();return false">Previous picture</a>
</p>
</body>
点击 Next picture 或 Previous picture 时,显示不出下一张图片(新手上路),请大虾们指教 !
<title>images 集合显示一个幻灯片</title>
<script type="text/javascript">
var currentPhoto=0;
var pics=new Array();
for(var i=0;i<5;i++){
pics[i]=new Image();
}
pics[0].src="../images/flower.bmp";
pics[1].src="../images/girls.jpg";
pics[2].src="../images/likes.jpg";
pics[3].src="../images/moon.jpg";
pics[4].src="../images/vehicle.jpg";
function changePhoto(photo){
document.images[0].src=pics[photo].src;
}
function nextPic(){
currentPhoto++;
if((currentPhoto<pics.length){
changePhoto(currentPhoto);
}else{
alert("At the end of the photo list");
}
}
function prevPic(){
if(pics.length>0){
currentPhoto--;
changePhoto(currentPhoto);
}else{
alert("At the beginning of the photo list");
}
}
</script>
</head>
<body> <img src="../images/girls.jpg" />
<p>
<a href="" onclick="nextPic();return false">Next picture</a><br />
<a href="" onclick="prevPic();return false">Previous picture</a>
</p>
</body>
点击 Next picture 或 Previous picture 时,显示不出下一张图片(新手上路),请大虾们指教 !
解决方案 »
- showbo大神,帮我看看样式问题
- jquery的click事件和网页的焦点问题
- jquery+li 树实现
- 问一下一个雅虎中国首页的文字上翻一个效果
- 高分求不在访问的情况下截取网站的图
- 我在做一棵树,现在遇到了一个大问题,我怎么能够知道我的一个父节点有多少个子节点?急!!!!!
- 如何解决消除用Window.open("所要打开的网页")时,产生的无法显示的页面?
- 小虾问高手们一个蠢问题:JavaScript和JSP有什么不同呀???
- JqueryMobile页面事件重复绑定
- easyui 单击table里的某条ID记录传到另一张table显示内容
- jQuery获取和赋值问题
- jQuery与Ajax的比较
http://blog.csdn.net/IBM_hoojo/archive/2010/06/08/5655506.aspx
http://blog.csdn.net/IBM_hoojo/archive/2010/06/07/5653246.aspx
多了个括号,语法错误