[英]Edit only javascript to add slideshow from images array
all I have a lot of html pages on the server that opens each big image into a new window calling just one external javascript file. 我在服务器上有很多html页面,它们将每个大图像打开到一个只调用一个外部javascript文件的新窗口。 I would like to edit this javascript so when I click on an image they all can be viewed using Prev and Next links buttons. 我想编辑这个javascript,所以当我点击图像时,他们都可以使用Prev和Next链接按钮查看。
here's the html code for images: 这是图像的html代码:
<td><a href="moreimages/imagebig01.jpg" onclick="NewWindow(this.href,'mywin','640','640','no','center');return false" onfocus="this.blur()" class="styling"><img src="moreimages/imagesmall01.jpg" width="70" border="0" alt="image small 1" title="image small 1"></a></td>
<td><a href="moreimages/imagebig02.jpg" onclick="NewWindow(this.href,'mywin','640','640','no','center');return false" onfocus="this.blur()" class="styling"><img src="moreimages/imagesmall02.jpg" width="70" border="0" alt="image small 2" title="image small 2"></a></td>
<td><a href="moreimages/imagebig03.jpg" onclick="NewWindow(this.href,'mywin','640','640','no','center');return false" onfocus="this.blur()" class="styling"><img src="moreimages/imagesmall01.jpg" width="70" border="0" alt="image small 3" title="image small 3"></a></td>
<td><a href="moreimages/imagebig04.jpg" onclick="NewWindow(this.href,'mywin','640','640','no','center');return false" onfocus="this.blur()" class="styling"><img src="moreimages/imagesmall04.jpg" width="70" border="0" alt="image small 4" title="image small 4"></a></td>
and here's the code from javascript file: 这是来自javascript文件的代码:
var imagesArray = []; //array to hold all images from moreimages.html
function getImageLinks() {
var a = document.getElementsByTagName("a") //get all elements that have <a> tag
for (h in a) { // walk thru this elements
var href = a[h].attributes['href']; //from an <a> element get his href attribute
if (href) { // check if <a> tag has a href attribute
imagesArray.push(href.value); //add the value of href (image link) to the array
}
}
}
var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){
LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
}
if(pos=="center"){
LeftPosition=(screen.width)?(screen.width-w)/2:100;
TopPosition=(screen.height)?(screen.height-h)/2:100;
}
else
if((pos!="center" && pos!="random") || pos==null){
LeftPosition=0;TopPosition=20
}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);
}
我想你想用滑块制作灯箱找到这个插件: 这里
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.