473,748 Members | 4,951 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

howto randomise starting pic in slideshow?

I have a slideshow, it uses

sigsImages=new Array()");

sigsImages[0]="sigs/finished1.jpg"
sigsImages[1]="sigs/foghorn.jpg"
sigsImages[2]="sigs/motto.jpg"
sigsImages[3]="sigs/sig.jpg"
sigsImages[4]="sigs/SWAT.jpg"
sigsImages[5]="sigs/title.gif"
sigscounter=sig sImages.length-1"
....
<td align="center"> <img id="sigsviewer " src="sigs/sig.jpg"></td>
....

Instead of manually puting a file for the starting pic, how do I set
it to a random pick?

I tried;

<td align="center"> <img id="sigsviewer " src=sigsImages[X]></td>

but that don't work.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Bow's and foggy's stored signatures</title>
<SCRIPT src="sigsheader .js"></SCRIPT>
</head>
<body
background="htt p://home.insightbb. com/clipart/backgrounds/bkgnd019.gif"
bgcolor="#fffff f" link="#0000ff" text="#000000" vlink="#ff0000" >
<h1 align="center"> Bow's and foggy's stored grahics</h1>
<h2 align="center" style="color: rgb(255, 0, 0);" color="red">Tea m
Special Forces</h2>
<SCRIPT src="sigsbody.j s"></SCRIPT>
<table align="center">
<tr>
<td>
<a href="/cgi-bin/GBEntry?owner=e mailid">
<img src="/global-images/guestbook/sign_gb.jpg" border="0"></a>
</td>
<td>
<P>Then email it to us at <a
href="mailto:Bo *******@insight bb.com">Bo***** **@insightbb.co m</a></p>
</td>
<td>
<a href="/cgi-bin/GBView?owner=em ailid">
<img src="/global-images/guestbook/view_gb.jpg" border="0"></a>
</td>
</tr>
</table>
</body>
</html>

document.writel n("<script type=\"text/javascript\">") ;

document.writel n("sigsImages=n ew Array()");

document.writel n("sigsImages[0]=\"sigs/finished1.jpg\" ");
document.writel n("sigsImages[1]=\"sigs/foghorn.jpg\"") ;
document.writel n("sigsImages[2]=\"sigs/motto.jpg\"");
document.writel n("sigsImages[3]=\"sigs/sig.jpg\"");
document.writel n("sigsImages[4]=\"sigs/SWAT.jpg\"");
document.writel n("sigsImages[5]=\"sigs/title.gif\"");

document.writel n("sigscounter= sigsImages.leng th-1");
document.writel n("sigsi=0");

document.writel n("function sigsfirst()");
document.writel n("{");
document.writel n("document.get ElementById(\'s igsviewer\').sr c=sigsImages[0]");
document.writel n("sigsi=0");
document.writel n("}");

document.writel n("function sigsprevious()" );
document.writel n("{");
document.writel n("if (sigsi>0)");
document.writel n("{");
document.writel n("sigsi--");
document.writel n("document.get ElementById(\'s igsviewer\').sr c=sigsImages[sigsi]");
document.writel n("}");
document.writel n("}");

document.writel n("function sigsnext()");
document.writel n("{");
document.writel n("if (sigsi<sigscoun ter)");
document.writel n("{");
document.writel n("sigsi++");
document.writel n("document.get ElementById(\'s igsviewer\').sr c=sigsImages[sigsi]");
document.writel n("}");
document.writel n("}");

document.writel n("function sigslast()");
document.writel n("{");
document.writel n("document.get ElementById(\'s igsviewer\').sr c=sigsImages[sigscounter]");
document.writel n("}");
document.writel n("<\/script>");
document.writel n("<center>") ;
document.writel n("<h1>sigs<\/h1>");
document.writel n("<form>");
document.writel n("<input value=\"First\" onclick=\"sigsf irst()\"
type=\"button\" >");
document.writel n("<input value=\"Previou s\" onclick=\"sigsp revious()\"
type=\"button\" >");
document.writel n("<input value=\"Next\" onclick=\"sigsn ext()\"
type=\"button\" >");
document.writel n("<input value=\"Last\" onclick=\"sigsl ast()\"
type=\"button\" >");
document.writel n("<\/form>");
document.writel n("<table border=\"1\">") ;
document.writel n("<tr>");
document.writel n("<td align=\"center\ "><img id=\"sigsviewer \"
src=\"sigs/sig.jpg\"><\/td>");
document.writel n("<\/tr>");
document.writel n("<\/table>");
document.writel n("<p><\/p>");
document.writel n("<form>");
document.writel n("<input value=\"First\" onclick=\"sigsf irst()\"
type=\"button\" >");
document.writel n("<input value=\"Previou s\" onclick=\"sigsp revious()\"
type=\"button\" >");
document.writel n("<input value=\"Next\" onclick=\"sigsn ext()\"
type=\"button\" >");
document.writel n("<input value=\"Last\" onclick=\"sigsl ast()\"
type=\"button\" >");
document.writel n("<\/form>");
document.writel n("<p><\/p>");
document.writel n("<p>If you have a sig<\/p>");
document.writel n("<\/center>");
Regards David. E. Goble
http://www.pnc.com.au/~degoble
degoble[AT]pnc.com.au | dgoble[AT]pnc.com.au
Po Box 648 (9 Murray St), Kingscote, Kangaroo Island SA 5223
Jul 23 '05 #1
1 2568
David. E. Goble wrote:
I have a slideshow, it uses
...
Instead of manually puting a file for the starting pic, how do I set
it to a random pick?
You have to use some kind of scripting, either on the server side or
client side with JavaScript. In either case, ciwa.html is not an
appropriate list. However, I will address your markup issues while your
here.
<td align="center"> <img id="sigsviewer " src=sigsImages[X]></td>
The align attribute is deprecated in favour of stylesheets. That same
effect can be achieved using this simple line of CSS (perhaps with a
slightly modified selctor, as appropriate)

td { text-align: center; }
but that don't work.
Of course the image doesn't do what you want because the src attribute
accepts a URI, not an a JavaScript variable. You have to keep in mind
that HTML, CSS and JavaScript are three totally seperate languages, and
you really need to learn how they work together and how they don't.
<body
background="htt p://home.insightbb. com/clipart/backgrounds/bkgnd019.gif"
bgcolor="#fffff f" link="#0000ff" text="#000000" vlink="#ff0000" >
Replace with CSS:

body { background: white url(.../bkgnd019.gif); color: black; }
:link { color: blue; }
:visited { color: red; }
<h1 align="center"> Bow's and foggy's stored grahics</h1>
h1 { text-align: center; }
<table align="center">
table { margin-left: auto; margin-right: auto; }

However, if this table is being used for layout purposes only, as it
appears to be, I suggest you remove the table completely and replace
with much leaner, semantic and valid code.
<a href="..."><img src="/global-images/guestbook/sign_gb.jpg" border="0"></a>
the border attribute can be replaced by this CSS:

a img { border: 0; }

...
</body>
</html>
What's all this crap you have after the end tag for the html element?
Is this supposed to be in another file? You really should indicate such
things more clearly.
document.writel n("<script type=\"text/javascript\">") ;
How do you expect this to be treated as script when it is not within a
script element itself? Any user agent should just treat this as text
after the end of a document

Are you aware that using document.write( ) is very bad practice, and you
should be using the standardised DOM methods instead?

document.writel n("sigsImages=n ew Array()");
What's the point of writing out each line of a script, using script? Do
you really expect this script to be executed like that? I haven't
checked, but I doubt it will.
document.writel n("<center>") ;


Like I've suggested all the way through, don't use presentational
elements and attributes when there are perfectly good CSS properties to
use instead.

Oh, and by the way, it might be worth while putting your markup through
the validator before doing anything else.
http://validator.w3.org/

--
Lachlan Hunt
http://lachy.id.au/
http://GetFirefox.com/ Rediscover the Web
http://SpreadFirefox.com/ Igniting the Web
Jul 23 '05 #2

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

Similar topics

2
3997
by: Susanna | last post by:
Hi all, I'm using the following slideshow script that I found on the web to display changing images with a crossfade effect. Eventually I will be adding many more images to the slideshow. The thing is, I ALSO have to make it so the images will load randomly. I have looked at a number of scripts for random-loading slideshows, but I have to find a way to COMBINE this fading-image script (or, a different fading-image script, if...
2
2101
by: Jeannie | last post by:
I have a popup window which is a slideshow of about 7 images. When the popup window loads, the first image is present and then the viewer can select next or previous to scroll through the rest of the images. I'd like to use the same popup window at different points throughout the website and have the Virtual Tour (slideshow) open up at the appropriate photos. Meaning I'd like to control which picture the popup window opens up to,...
4
1627
by: Luis Veras | last post by:
I have a slideshow on my main page at www.canvasartists.com. Many of my visitors started to complain that on their screen the slideshow displays as flashing and/or blinking very quickly, and you can't really appreciate the slideshow effect, which is supposed to be a nice crossfade between the images. I then realized than when viewed at 800x600 or lower it does this. Sometimes it also does it at higher resolution, but with your browser...
8
2036
by: drillbit_99 | last post by:
I have an HTML page of thumbnail images. Each image can begin a slideshow of the images on the page by clicking on the image. This opens another HTML page that begins the slideshow using large images of the thumbnails. When the slideshow begins it always starts with the first image. I would like to pass the name of the thumbnail to the slideshow HTML page and begin the slideshow with the same image the user clicks on. Is this asking...
11
2405
by: David Graham | last post by:
Hi New to javascript. I'm trying to understand how a script at a website I come across works. http://www.BRPPISAFETY.COM Nearly got it but I have changed the variable called 'crossFadeDuration' to large numbers and small numbers but it doesn't seem to do anything. Could someone explain what effect changing this variable should bring about and why don't I see any changes. many thanks David
1
3347
by: ttamilvanan81 | last post by:
Hai everyone, I need to provide the slideshow for the images. I have upload the images into database. Then i will retrive all the images from the database and provide the slideshow for those images. I have try with the following jsp code. <%@ page language="java" %> <%@ page import="java.sql.*"%> <%@ page import="java.sql.Connection.*"%> <%@ page import="java.awt.image.*"%>
2
3142
pradeepjain
by: pradeepjain | last post by:
script> // (C) 2000 www.CodeLifter.com // http://www.codelifter.com // Free for all users, but leave in this header // NS4-6,IE4-6 // Fade effect only in IE; degrades gracefully // ======================================= // set the following variables // =======================================
0
8989
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
8828
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
9367
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...
1
6795
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
6073
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
4869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3309
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
2780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2213
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.