473,883 Members | 2,186 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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>Slidesho w Tutorial</TITLE>

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

var timer = null
var counter =1

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

if (counter >= 6)
counter = 2;
document.pictur es.src = pic[counter].src;
}
function endtimer() {
clearTimeout(ti mer);
document.pictur es.src = pic[1].src;
counter = 1;
}

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

<BODY BACKGROUND="FFF FFF">

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

if (document.image s) {

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 6572
wrote on 24 okt 2005 in comp.lang.javas cript:
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.javas cript:
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="image s/main-nrseries.gif";
pic2= new Image(pic_width ,pic_height);
pic2.src="image s/main-enseries.gif";
pic3= new Image(pic_width ,pic_height);
pic3.src="image s/main-evseries.gif";
pic4= new Image(pic_width ,pic_height);
pic4.src="image s/main-mciseries.gif";
pic5= new Image(pic_width ,pic_height);
pic5.src="image s/main-enlseries.gif";
pic6= new Image(pic_width ,pic_height);
pic6.src="image s/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.image s)
{
pic1= new Image(550,245);
pic1.src="image s/main-nrseries.gif";
pic2= new Image(pic_width ,pic_height);
pic2.src="image s/main-enseries.gif";
pic3= new Image(pic_width ,pic_height);
pic3.src="image s/main-evseries.gif";
pic4= new Image(pic_width ,pic_height);
pic4.src="image s/main-mciseries.gif";
pic5= new Image(pic_width ,pic_height);
pic5.src="image s/main-enlseries.gif";
pic6= new Image(pic_width ,pic_height);
pic6.src="image s/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.image s)
{
document.write( "<img src='"+pics[thenum]+"' border='0'
width='"+pic_wi dth+"' height='"+pic_h eight+"' name='img1'>\n" );
setTimeout('cha nge_it2()',4000 );
}
}

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

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

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

Oct 24 '05 #6
wrote on 24 okt 2005 in comp.lang.javas cript:
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,getEle mentById('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(sho w(),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.javas cript:
set.timeout(sho w(),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="image s/main-nrseries.gif";
pic2= new Image(550,245);
pic2.src="image s/main-enseries.gif";
pic3= new Image(550,245);
pic3.src="image s/main-evseries.gif";
pic4= new Image(550,245);
pic4.src="image s/main-mciseries.gif";
pic5= new Image(550,245);
pic5.src="image s/main-enlseries.gif";
pic6= new Image(550,245);
pic6.src="image s/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

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

Similar topics

4
2415
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 one step further and can't figure out how to do it... I want to have it so that when the person clicks on the specific ad, they are taken to a URL that is unique to each ad. I presume I would have to surround the img tag with an href tag, but...
1
3233
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 that pulls images randomly from a directory? Thus I would need only add (or delete) images from that directory and they would display on the web page respectively. All the images are the same size (90x90) but there are hundreds so hard coding...
4
1797
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 downloaded before it starts or will it show in the forground and continue downloading in the background? I have a lot of pic's but many will try to view on 56k dial-up. thanks for any help - tmb
1
2117
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 images, even worse they are not loading completely. This version includes a (vain) attempt at forcing the banner images to cache. Apart form the caching problem the scripting seems to work Any help welcomed:
31
7068
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 contents of each cell (picture/link and associated text) rotate randomly. Note that the text titles must remain with their associated picture and link (I don't want to scramble all the elements--just rotate the entire contents of the table cell).
2
2826
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, rotates banners with hyperlink specific to each image. it works just perfect but i need a simple modification. now I want to stop rotating the images when I mouseover on the image, and then continue once I move the cursor out of the banner image....
9
6847
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. When i try to rotate i get an error, although i think the concept is right. With some testing i figured out thet I get the error when x = 4 and y = 1 i think. Memory read access violation or something. Im using Visual C++ 2005 express edition and...
6
3245
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
9953
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9799
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10768
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9588
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7980
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7137
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5808
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4623
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4231
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.