如何在Dreamweaver里实现图片的上一页下一页切换
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>简单的幻灯片效果</title>
</head>
<body>
<script type="text/javascript">
var picArr=new Array("1.jpg","2.jpg","3.jpg");
var index=0;
function next(){
index++;
if(index==picArr.length){
index=0;
}
document.getElementById("imgp").src=picArr[index];
}
function previous(){
index--;
if(index<0){
index=picArr.length-1;
}
document.getElementById("imgp").src=picArr[index];
}
</script>
</body>
<img src="1.jpg" id="imgp" />
</br>
<input type="button" value="下一张" onclick="next()"/>
<input type="button" value="上一张" onclick="previous()" />
</html>
2024-07-20 广告
广告 您可能关注的内容 |