473,385 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Java rotating image script

Why would this script below work on an html page:
http://www.eg-designdev.com/aircylinders/test.htm
But not a java page such as this:
"http://www.eg-designdev.com/aircylinders/index3.jsp"

Or does anybody have a simple slide show rotation script they could
refer me to...thanks.
<HTML><HEAD>
<TITLE>Slideshow Tutorial</TITLE>

<SCRIPT LANGUAGE="JavaScript">
<!-- Beginning of JavaScript -

var timer = null
var counter =1

function slideshow() {
timer=setTimeout("slideshow()", 2000);
counter++;

if (counter >= 6)
counter = 2;
document.pictures.src = pic[counter].src;
}
function endtimer() {
clearTimeout(timer);
document.pictures.src = pic[1].src;
counter = 1;
}

// - End of JavaScript - -->
</SCRIPT>
</HEAD>

<BODY BACKGROUND="FFFFFF">

<SCRIPT LANGUAGE="JavaScript">
<!-- Beginning of JavaScript -

if (document.images) {

pic = new Array()

pic[1] = new Image(108, 108);
pic[1].src = "pic1.gif";

pic[2] = new Image(108, 108);
pic[2].src = "pic2.gif";

pic[3] = new Image(108, 108);
pic[3].src = "pic3.gif";

pic[4] = new Image(108, 108);
pic[4].src = "pic4.gif";

pic[5] = new Image(108, 108);
pic[5].src = "pic5.gif";
}

// - End of JavaScript - -->
</SCRIPT>

<CENTER>
<TABLE BORDER=0 CELLSPACING="0" CELLPADDING="0">
<TR></TR>

<TR>
<TD><IMG SRC="images/main-nrseries.gif" WIDTH="550" HEIGHT="245"
NAME="pictures"></TD>

</body>
</html>

Oct 24 '05 #1
14 6515
wrote on 24 okt 2005 in comp.lang.javascript:
Why would this script below work on an html page:
http://www.eg-designdev.com/aircylinders/test.htm
But not a java page such as this:
"http://www.eg-designdev.com/aircylinders/index3.jsp"


Because your server is not a jsp enabled server?

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Oct 24 '05 #2
Would that be the reason? I'm working on getting it turned on, but the
guy is taking forever for some reason.

Oct 24 '05 #3
wrote on 24 okt 2005 in comp.lang.javascript:
Would that be the reason? I'm working on getting it turned on, but the
guy is taking forever for some reason.


Which guy?

[please do quote on usenet, others should be able to follow threads on
usenet]

Why would you want to use a jsp extention?
Javascript has nothing to do with jsp or java.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Oct 24 '05 #4
>Why would you want to use a jsp extention?
Javascript has nothing to do with jsp or java.


I didn't build this site, I'm cleaning up someones mess. I wouldn't use
a jsp extension but it's already there. I know Javascript has nothing
to do with jsp that's why I was thrown off by it. I have found
something that worked though and now all I need to know is how to
define an array to link the images I have in my gallery.

{
pic1= new Image(550,245);
pic1.src="images/main-nrseries.gif";
pic2= new Image(pic_width,pic_height);
pic2.src="images/main-enseries.gif";
pic3= new Image(pic_width,pic_height);
pic3.src="images/main-evseries.gif";
pic4= new Image(pic_width,pic_height);
pic4.src="images/main-mciseries.gif";
pic5= new Image(pic_width,pic_height);
pic5.src="images/main-enlseries.gif";
pic6= new Image(pic_width,pic_height);
pic6.src="images/main-ensseries.gif";
}

/* define text for image captions */

var pics= new Array(6)
pics[0]=pic1.src;
pics[1]=pic2.src;
pics[2]=pic3.src;
pics[3]=pic4.src;
pics[4]=pic5.src;
pics[5]=pic6.src;

Oct 24 '05 #5
Ok I know have two problems.
1. Like I stated above, I'm not sure how to define an array to link
these images in the slideshow.
2. The slideshow only go through once then just stops.

Here's the code:

<script type="text/javascript">
<!--
/* define image width and height */

var pic_width=550;
var pic_height=245;

/* define image urls */

if (document.images)
{
pic1= new Image(550,245);
pic1.src="images/main-nrseries.gif";
pic2= new Image(pic_width,pic_height);
pic2.src="images/main-enseries.gif";
pic3= new Image(pic_width,pic_height);
pic3.src="images/main-evseries.gif";
pic4= new Image(pic_width,pic_height);
pic4.src="images/main-mciseries.gif";
pic5= new Image(pic_width,pic_height);
pic5.src="images/main-enlseries.gif";
pic6= new Image(pic_width,pic_height);
pic6.src="images/main-ensseries.gif";
}

/* define text for image captions */

var pics= new Array(6)
pics[0]=pic1.src;
pics[1]=pic2.src;
pics[2]=pic3.src;
pics[3]=pic4.src;
pics[4]=pic5.src;
pics[5]=pic6.src;

var numpics=6;
var thenum=0;
imgName="img1";

function change_it()
{
if (document.images)
{
document.write("<img src='"+pics[thenum]+"' border='0'
width='"+pic_width+"' height='"+pic_height+"' name='img1'>\n");
setTimeout('change_it2()',4000);
}
}

function change_it2()
{
var x=0;
thenum+=1;

if (thenum>numpics-1)
{
document[imgName].src=pics[0];
document.form1.text1.value="The End";
}
else
{
document[imgName].src=pics[thenum];

x+=1;
setTimeout('change_it2()',4000);
}
}
//-->
</script>

Oct 24 '05 #6
wrote on 24 okt 2005 in comp.lang.javascript:
Ok I know have two problems.
1. Like I stated above, I'm not sure how to define an array to link
these images in the slideshow.
2. The slideshow only go through once then just stops.

Here's the code:

<script type="text/javascript">
<!--

this <!-- is not needed since 6 years

var pic_width = 550;
var pic_height = 245;
var pic = new Array();
var n = 0;

pic[n] = new Image(pic_width,pic_height);
pic[n++].src = "images/main-nrseries.gif"; // preloading
pic[n] = new Image(pic_width,pic_height);
pic[n++].src = "images/main-enseries.gif";
pic[n] = new Image(pic_width,pic_height);
pic[n++].src = "images/main-evseries.gif";
pic[n] = new Image(pic_width,pic_height);
pic[n++].src = "images/main-mciseries.gif";
pic[n] = new Image(pic_width,pic_height);
pic[n++].src = "images/main-enlseries.gif";
pic[n] = new Image(pic_width,pic_height);
pic[n++].src = "images/main-ensseries.gif";

var numpics = n;
var img1 = document,getElementById('img1');
n = 0; // reuse as counter

function show(){
img1.src = pic[n].src; // show the img
n++; // increment pointer
if (n == numpics) n = 0; // rotating if last img
set.timeout(show(),20000); // 20 seconds/img
};
</script>

<body onload='show();'>

<img src='..' id=img1>

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Oct 24 '05 #7
Evertjan. wrote on 24 okt 2005 in comp.lang.javascript:
set.timeout(show(),20000); // 20 seconds/img


setTimeout()

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Oct 24 '05 #8
Thank you. As you can tell I'm new to this. I appreciate it.

Oct 24 '05 #9
Ok one more question. I have this slideshow working now. I just need to
link the images in the slideshow to different pages in the site. How do
i do this? Do I define a new array for links I'm assuming?

{
pic1= new Image(550,245);
pic1.src="images/main-nrseries.gif";
pic2= new Image(550,245);
pic2.src="images/main-enseries.gif";
pic3= new Image(550,245);
pic3.src="images/main-evseries.gif";
pic4= new Image(550,245);
pic4.src="images/main-mciseries.gif";
pic5= new Image(550,245);
pic5.src="images/main-enlseries.gif";
pic6= new Image(550,245);
pic6.src="images/main-ensseries.gif";
}

/* define text for image captions */

var pics= new Array(6)
pics[0]=pic1.src;
pics[1]=pic2.src;
pics[2]=pic3.src;
pics[3]=pic4.src;
pics[4]=pic5.src;
pics[5]=pic5.src;

Oct 24 '05 #10
wrote on 24 okt 2005 in comp.lang.javascript:
Ok one more question. I have this slideshow working now. I just need to
link the images in the slideshow to different pages in the site. How do
i do this? Do I define a new array for links I'm assuming?


Please quote, this is not email, others want to read too.

==============
Something like this?
<style>img {cursor:hand;pointer:hand;}</style>

.....................

var alink = new Array()

..................

pic[n] = new Image(pic_width,pic_height);
alink[n] = 'http://cnn.com/'
pic[n++].src = "images/main-ensseries.gif";

..................

function show(){
img1.src = pic[n].src;
img1.onclick = 'location.href='+alink[n]
n++;
if (n == numpics) n = 0;
set.timeout(show(),20000);
};
</script>

<body onload='show();'>

<img src='..' id=img1>
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Oct 24 '05 #11
JRS: In article <Xn********************@194.109.133.242>, dated Mon, 24
Oct 2005 18:09:09, seen in news:comp.lang.javascript, Evertjan.
<ex**************@interxnl.net> posted :
Evertjan. wrote on 24 okt 2005 in comp.lang.javascript:
set.timeout(show(),20000); // 20 seconds/img


setTimeout()


setTimeout("show()", 20e3) // ?
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME. ©
Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
The Big-8 newsgroup management is attempting to legitimise its questionable
practices while retaining its elitist hegemony. Read <URL:news:news.groups>.
Oct 25 '05 #12
Dr John Stockton wrote on 25 okt 2005 in comp.lang.javascript:
setTimeout("show()", 20e3) // ?


setTimeout("show()", 2e4) // !
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Oct 25 '05 #13
JRS: In article <Xn********************@194.109.133.242>, dated Tue, 25
Oct 2005 19:48:28, seen in news:comp.lang.javascript, Evertjan.
<ex**************@interxnl.net> posted :
Dr John Stockton wrote on 25 okt 2005 in comp.lang.javascript:
setTimeout("show()", 20e3) // ?


setTimeout("show()", 2e4) // !


I think it's worth the extra character to have the time in seconds
visible directly.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Oct 26 '05 #14
Dr John Stockton wrote on 26 okt 2005 in comp.lang.javascript:
JRS: In article <Xn********************@194.109.133.242>, dated Tue, 25
Oct 2005 19:48:28, seen in news:comp.lang.javascript, Evertjan.
<ex**************@interxnl.net> posted :
Dr John Stockton wrote on 25 okt 2005 in comp.lang.javascript:
setTimeout("show()", 20e3) // ?


setTimeout("show()", 2e4) // !


I think it's worth the extra character to have the time in seconds
visible directly.


I knew you would say that!

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Oct 26 '05 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Ian Hubling | last post by:
I'm trying to complete a rotating banner ad within a page I have. The rotating add has four images that rotate in three-second increments. I've got the images to rotate ok - but now I want to go...
1
by: Sandy Bremmer | last post by:
I have seen many Javascripts that rotate images with each load or refresh of the page but so far all I've found require hard coding the image filename into the script. Does anyone know of a script...
4
by: tmb | last post by:
I want to do a slide show with a script something like http://www.abiglime.com/webmaster/articles/jscript/021298.htm My Question: Will the client wait on all pic's in the slice show to be...
1
by: Grunt | last post by:
Hi, I have been trying to put together a rotating banner. the code works but I am having a problem with the caching of the banner images. no matter what I try the page is constantly reloading the...
31
by: Royal Denning | last post by:
I am designing a table with 2 columns and 20 rows. I want to insert small images (each with a link) and a text title in each cell of the table. On refresh of the page, I would like to have the...
2
by: sgMuser | last post by:
Hi, I am not a good developer of Javascript codes. Needs this help to make some modification to this famous free javascript from Anarchos. i am using this in one of my webpage. What it does is,...
9
by: Kraken | last post by:
Hi, i have an assignment to open PPM images and prompt the user for either brightening, flipping or rotating the image. Ive done the brightening and flipping, but i cant get the rotating to work....
6
by: swethak | last post by:
Hi, I displayed the image taken from database.How to raotate that image using javascript.plz tell that how to start the logic.plz tell that some reference websites.
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.