Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone

i have been stuck on making my slideshow work on my website for a while now and hoping you experts can point me in the right direction? I am a noob when it comes to HTML, Java etc etc. So please be nice here is my code: So basically it works locally but once uploaded to my web server via ftp it doesn't? your help is much appreciated thanks!
C#
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<link href="CSS/style_tut.css" rel="stylesheet" type="text/css">

<style type="text/css">
#slider{
height:450px;
width:650px;
margin: 20px auto;
position:relative;
}
#img{
height:450px;
width:650px;
position:absolute;
}
#left_holder{
height:450px;
width:100px;
position:absolute; 
left:0px;
top:0px;
}
#right_holder{
height:450px;
width:100px;
position:absolute;
right:0px;
top:0px;
}
.left{
height:50px;
width:50px;
position:absolute;
top:40%;
left:0px;
}
.right{
height:50px;
width:50px;
position:absolute;
top:40%;
left:50px;
}
</style>

<script src="js/alert_tut.js">
var imagecount = 1;
var total = 5;

function slide(x) {
var Image = document.getElementById('img');
imagecount = imagecount + x;
if(imagecount > total){ imagecount = 1;}
if(imagecount < 1){ imagecount = total;}
Image.src = "images/img"+ imagecount +".jpg";
}
window.setInterval(function slideA() {
var Image = document.getElementById('img');
imagecount = imagecount + 1;
if(imagecount > total){ imagecount = 1;}
if(imagecount < 1){ imagecount = total;}
Image.src = "images/img"+ imagecount +".jpg";
},5000);

</script> 

</head>

<body onLoad="slideA()">
<div id="slider">
<img src="images/img1.jpg" id="image" >
<div class="left_hold"><img ></div>
<div class="right_hold"><img ></div>
</div>

</body>
</html>
Posted
Updated 30-Jan-15 2:36am
v2
Comments
Sinisa Hajnal 30-Jan-15 7:37am    
Please remove unnecessary code and use "code" button to format and highlight your code . Ensure that all files are copied on the server and that relative paths are the same.
ZurdoDev 30-Jan-15 7:45am    
If it works locally but no on the server then Anthony in Solution 1 may be right in that you are missing something. Something did not get uploaded.

But what would help more is to explain what does not work.
Member 11414568 30-Jan-15 8:52am    
sorry forgot to mention. So it is a image slide show with 6 images and only image one works and the rest show "404 error" and Uncaught ReferenceError: slideA is not defined? So i was thinking it maybe a file missing but not sure am I allow to post my URL here? Thanks
Member 11414568 30-Jan-15 8:53am    
I have double checked all file locations and everything seems to be where it should
Thanks for your quick replies
ZurdoDev 30-Jan-15 8:58am    
404 as you know means it cannot be found.

You have a very picky webserver. The folder structure is case sensitive. When inspecting the element in google dev tools I could see that the first one was images/img1.jpg and the next images were loaded as Images/imgx.jpg.

So, this url is valid, http://www.defiximports.com/images/img2.jpg[^]

but this one is not

http://www.defiximports.com/Images/img2.jpg[^]

Silly webserver. I don't think IIS is case sensitive and that is pretty annoying, IMO. Not sure what you're hosting on.

So, just change your links to images instead of Images.
 
Share this answer
 
Thanks to RyanDev for pointing me in the right direction! It came down to the alert_tut.js file needing "Images" changed to "images" and images being cache so what i did was clear the cache re-uploaded files and everything is working now thanks to RyanDev once again.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900