我正在使用html和javascript来创建照片库。
当我在本地计算机上测试代码时,它工作正常,但是当我把它放在网站上时它没有用。
问题是微型照片出现但我无法点击它们就像空链接一样!
这是代码(我在互联网上使用它),这是代码的链接
http://www.dhtmlgoodies.com/index.html?whichScript=image_slideshow
<div id="dhtmlgoodies_slideshow">
<div id="previewPane">
<img src="images/gallerie/image111_max.jpg">
<span id="waitMessage">Loading image. Please wait</span>
<div id="largeImageCaption"></div>
</div>
<div align="center" id="galleryContainer">
<div id="arrow_left"><img src="images/gallerie/arrow_left.gif"></div>
<div id="arrow_right"><img src="images/gallerie/arrow_right.gif"></div>
<div id="theImages">
<!-- Thumbnails -->
<a href="#" onClick="showPreview('images/gallerie/image111_max.jpg','1');return false"><img src="images/gallerie/image111_min.jpg"></a>
<a href="#" onClick="showPreview('images/gallerie/image112_max.jpg','2');return false"><img src="images/gallerie/image112_min.jpg"></a>
<a href="#" onClick="showPreview('images/gallerie/image123_max.jpg','3');return false"><img src="images/gallerie/image123_min.jpg"></a>
<a href="#" onClick="showPreview('images/gallerie/image124_max.jpg','4');return false"><img src="images/gallerie/image124_min.jpg"></a>
<a href="#" onClick="showPreview('images/gallerie/image125_max.jpg','5');return false"><img src="images/gallerie/image125_min.jpg"></a>
<a href="#" onClick="showPreview('images/gallerie/image126_max.jpg','6');return false"><img src="images/gallerie/image126_min.jpg"></a>
<!-- Image captions -->
<div class="imageCaption">(1)</div>
<div class="imageCaption">(2)</div>
<div class="imageCaption">(3)</div>
<div class="imageCaption">(4)</div>
<div class="imageCaption">(5)</div>
<div class="imageCaption">(6)</div>
<div id="slideEnd"></div>
脚本
image_slidshow.js
var displayWaitMessage=true; // Display a please wait message while images are loading?
var activeImage = false;
var imageGalleryLeftPos = false;
var imageGalleryWidth = false;
var imageGalleryObj = false;
var maxGalleryXPos = false;
var slideSpeed = 0;
var imageGalleryCaptions = new Array();
function startSlide(e)
{
if(document.all)e = event;
var id = this.id;
this.getElementsByTagName('IMG')[0].src = 'images/gallerie/' + this.id + '_over.jpg';
if(this.id=='arrow_right'){
slideSpeedMultiply = Math.floor((e.clientX - this.offsetLeft) / 5);
slideSpeed = -1*slideSpeedMultiply;
slideSpeed = Math.max(-10,slideSpeed);
}else{
slideSpeedMultiply = 10 - Math.floor((e.clientX - this.offsetLeft) / 5);
slideSpeed = 1*slideSpeedMultiply;
slideSpeed = Math.min(10,slideSpeed);
if(slideSpeed<0)slideSpeed=10;
}
}
function releaseSlide()
{
var id = this.id;
this.getElementsByTagName('IMG')[0].src = 'images/gallerie/' + this.id + '.jpg';
slideSpeed=0;
}
function gallerySlide()
{
if(slideSpeed!=0){
var leftPos = imageGalleryObj.offsetLeft;
leftPos = leftPos/1 + slideSpeed;
if(leftPos>maxGalleryXPos){
leftPos = maxGalleryXPos;
slideSpeed = 0;
}
if(leftPos<minGalleryXPos){
leftPos = minGalleryXPos;
slideSpeed=0;
}
imageGalleryObj.style.left = leftPos + 'px';
}
setTimeout('gallerySlide()',20);
}
function showImage()
{
if(activeImage){
activeImage.style.filter = 'alpha(opacity=50)';
activeImage.style.opacity = 0.5;
}
this.style.filter = 'alpha(opacity=100)';
this.style.opacity = 1;
activeImage = this;
}
function initSlideShow()
{
document.getElementById('arrow_left').onmousemove = startSlide;
document.getElementById('arrow_left').onmouseout = releaseSlide;
document.getElementById('arrow_right').onmousemove = startSlide;
document.getElementById('arrow_right').onmouseout = releaseSlide;
imageGalleryObj = document.getElementById('theImages');
imageGalleryLeftPos = imageGalleryObj.offsetLeft;
var galleryContainer = document.getElementById('galleryContainer');
imageGalleryWidth = galleryContainer.offsetWidth - 80;
maxGalleryXPos = imageGalleryObj.offsetLeft;
minGalleryXPos = imageGalleryWidth - document.getElementById('slideEnd').offsetLeft;
if (navigator.userAgent.indexOf('MSIE') >= 0) {
var arrowWidth = document.getElementById('arrow_left').offsetWidth;
var el = document.createElement('div');
el.style.position = 'absolute';
el.style.left = arrowWidth + 'px';
el.style.width = (galleryContainer.offsetWidth - arrowWidth * 2) + 'px';
el.style.overflow = 'hidden';
el.style.height = '100%';
document.getElementById('galleryContainer').appendChild(el);
el.appendChild(document.getElementById('theImages'));
}
var slideshowImages = imageGalleryObj.getElementsByTagName('IMG');
for(var no=0;no<slideshowImages.length;no++){
slideshowImages[no].onmouseover = showImage;
}
var divs = imageGalleryObj.getElementsByTagName('DIV');
for(var no=0;no<divs.length;no++){
if(divs[no].className=='imageCaption')imageGalleryCaptions[imageGalleryCaptions.length] = divs[no].innerHTML;
}
gallerySlide();
}
function showPreview(imagePath,imageIndex){
var subImages = document.getElementById('previewPane').getElementsByTagName('IMG');
if(subImages.length==0){
var img = document.createElement('IMG');
document.getElementById('previewPane').appendChild(img);
}else img = subImages[0];
if(displayWaitMessage){
document.getElementById('waitMessage').style.display='inline';
}
document.getElementById('largeImageCaption').style.display='none';
img.onload = function() { hideWaitMessageAndShowCaption(imageIndex-1); };
img.src = imagePath;
}
function hideWaitMessageAndShowCaption(imageIndex)
{
document.getElementById('waitMessage').style.display='none';
document.getElementById('largeImageCaption').innerHTML = imageGalleryCaptions[imageIndex];
document.getElementById('largeImageCaption').style.display='block';
}
window.onload = initSlideShow;
的更新 的
当我打开控制台网页时,错误是:
[11:36:48,021] GET http://www.mess.tn/mywebsite/scripts/image-slideshow.js [HTTP / 1.1 404未找到11ms]
答案 0 :(得分:0)
您的错误显示:image-slideshow.js
未找到
当您的示例文件显示为:image_slidshow.js