Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help me out with slideshow pleasee

Status
Not open for further replies.

JaMaIcAnYuTe

IS-IT--Management
Jul 13, 2006
10
US
Ok.need lots of elp and i really appreciate the help guys.Im trying to make a slidewhow on a webpage to change images.at the moment,the images change when you press a forward and back button, what i really would like is to get the images to change automatically by them selve, but i have no clue what to input .
var photos=new Array()
var text=new Array()
var which=0
var what=0

photos[0]="photos[1]="images/midflorida.jpg"
photos[2]="images/somerset.jpg"
photos[3]="images/rock springs.jpg"
photos[4]="images/crystal hills.jpg"
photos[5]="images/fawn meadows.jpg"
photos[6]="images/apopka.jpg"
photos[7]="images/sawfish.jpg"
photos[8]="images/golden.jpg"


text[0]="4/2 1/2 home for sale-Kissimmee Florida"
text[1]="1/1 Loft for rent-Orlando Florida"
text[2]="4/3 home for sale-Kissimmee Florida"
text[3]="3/3 home for sale/lease-Apopka Florida"
text[4]="Triplex for sale-Lakeland Florida"
text[5]="3/2 home for sale/lease-St Cloud Florida"
text[6]="4/3 home for sale/lease-Apopka Florida"
text[7]="3/2 home for sale-Kissimmee Florida"
text[8]="3/3 home for sale-Orlando Florida"

window.onload=new Function("document.rotater.description.value=text[0]")

function backward(){
if (which>0){
window.status=''
which--
document.images.photoslider.src=photos[which];
what--
document.rotater.description.value=text[what];
}
}

function forward(){
if (which<photos.length-1){
which++
document.images.photoslider.src=photos[which]
what++
document.rotater.description.value=text[what];
}
else window.status='End of gallery'
}

function type()
{
alert("This textbox will only display default comments")
}
 
Do a google search for "javascript setinterval" and that should get you started on the right track.

-kaht

[small]How spicy would you like your chang sauce? Oh man... I have no idea what's goin' on right now...[/small]
[banghead]
 
Thanx alot kaht,will check out the setinterval and see what happens.So would i be able to frely and easily take out the buttons and place in the interval and get it done that quick.?
 
Kaht, i really not understanding at all man...i checked the site and all, but im just clueless of what to take out and how to make these images start switching on their own with the "text" description.
 
if you are looking to change the image every few seconds as if you were calling the forward function use setinterval.

For example you could use it in the body tag

<body onload="window.setInterval(forward(), 5000)">

what setInterval(forward(), 5000) does is call the forward function every 5000 milli seconds (1000ths of a second)
 
Thanx for replying THEBEAST........i placed the setInterval code into the body tag as you said, and then i deleted the code below that controlled the forwar and bacward movement of the picture,however when i try to run everything,neither the pictures not the text moves,everything just stands still at the moment.

function backward(){
if (which>0){
window.status=''
which--
document.images.photoslider.src=photos[which];
what--
document.rotater.description.value=text[what];
}
}

function forward(){
if (which<photos.length-1){
which++
document.images.photoslider.src=photos[which]
what++
document.rotater.description.value=text[what];
}
else window.status='End of gallery'
}

 
The line setInterval(forward(), 5000) calls on your function forward() so if you took out that code nothing is going to happen except that every 5 seconds your setinterval is going to make a call to a non-existing function and cause errors.

All setinterval is doing is making your own function automatically execute at fixed lengths of time, it does not do the work of the functions themselves.


At my age I still learn something new every day, but I forget two others.
 
ok,i guess im he dumbest person in here.thanx for the reply all you people.i really appreciate it, i guess the rest is up to me.I placed the setInterval(forward(), 5000) in the body tag.I know for sure that the backward code in the bottom will go, but what editing do i have to do in order to allow all this to wrok completely.?
 
did it work when you just added the setInterval.... into the <body> tag?
 
can you try making it work on clicking something something like

<p onclick="window.setInterval(forward(), 5000)">clicking here should work</p>

let me know if it works
 
OK,when i set it to onclick it changes whenever i click anywhere on the page, however before every change it makes an error comes up, then the page fgoes back to a different color due to the other code thats also in the <body> tag "style="background-color: #000080">
 
Just new to this forum, so hope I'm in the right place. Re a slideshow there is a downloadable demo (with code) having several options at:
I have a question relating to the code from this site. (See end for code) It uses a form & part of the output displays the URL of the image/picture. I wish to truncate the first 18 characters of the URL (directory portion etc) and the last four, the extension (.jpg etc). The **** line illustrates this. The ++++ line is meant to obtain the length of the URL, less 4.
Removing the -4 gives output deleting the first 18 chars, but leaves on the extension. How do I get the appropriate value?

function showAd() {
var srcobject;
var lengthstr = eval(document.slide.tit.length)-4; //++++
document.slide.tit.value=adImages[thisAd].substring(18,lengthstr); //****
document.adBanner.src = adImages[thisAd];

. . . and in the 'body' part is a line

<input name="tit" type="text" size="30" readonly="readonly">
referring to a TextField for the title "tit"
Any help most appreciated.
David
 
YOU SHOULD HAVE MADE A NEW THREAD MAN.GOSH.!!! NOW YOUR GOING TO HAVE PEOPLE ANSWERING TWO DIFFERENT QUESTIONS IN ONE THREAD.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top