I'm new to this, and stole/doctored my code from the "Ugly JavaScript
Handbook"
I have a slide show program.
First theres stuff to set up the array, and the time between slides
Then a function startIt()is defined
then a function stopIt()
Then two buttons, Start and Stop, which when pressed call the relevant
functions
When the page loads, you have to click the Start button to get the
slide show running, but I'd like it to start running straight away
without having to click.
I can't for the life of me figure this out.
I thought it was just a question of putting the line
startIt();
in the appropriate place.
Here's the whole of the code
Thanks
Tony
<HTML><HEAD>
<TITLE>Holida y</TITLE>
<SCRIPT LANGUAGE="JavaS cript">
<!-- Hide from JavaScript-Impaired Browsers
var ctr=1;
var pics=17;
var speed=3500; // set initial
var ns="0123456789" ; // number index
/* First, create a new array and then
create an image holder and load it
with the logo animation images. */
isn=new Array();
startIt()
for (i=1;i<=pics;i+ +){
isn[i]=new Image();
isn[i].src=i+".jpg";
}
startIt()
/* Next do the same for the number
images to display speed. */
nr=new Array();
for (i=0;i<=pics;i+ +){
nr[i]=new Image();
nr[i].src="nr/"+i+".jpg";
startIt()
}
function startIt(){
document.ugly.s rc=isn[ctr].src;
ctr=(ctr>(pics-2)?1:++ctr);
/* Here we put a "hook" on the
setTimeout() call by naming it.
This allows the clearTimeout()
call to know which one (there
might be others) to stop. */
tstop=setTimeou t("startIt()",s peed);
}
startIt()
function stopIt(){
clearTimeout(ts top);
}
startIt()
// End Hiding -->
</SCRIPT>
startIt()
</HEAD>
<BODY BGCOLOR="white" ><CENTER>
<P><B>Ginny & Eva tour Europe</B>
<P><IMG SRC="5.jpg" height="350" NAME="ugly" BORDER="0">
<P><FORM>
<P><INPUT TYPE="button" NAME="b1" onClick="startI t()" VALUE=" Start
Slide Show">
startIt();
<INPUT TYPE="button" NAME="b2" onClick="stopIt ()" VALUE=" Stop Slide
show">
</FORM>
startIt()
<P>Present delay (milliseconds):
<IMG SRC="nr/1.gif" WIDTH="7" HEIGHT="10" BORDER="0">
<IMG SRC="nr/0.gif" WIDTH="70" HEIGHT="10" BORDER="0">
<IMG SRC="nr/0.gif" WIDTH="70" HEIGHT="10" BORDER="0">
<IMG SRC="nr/0.gif" WIDTH="7" HEIGHT="10" BORDER="0">
startIt()
</BODY>
startIt()
</HTML> 2 7077
"TonyJeffs" <to*******@aol. com> wrote in message
news:8e******** *************** ***@posting.goo gle.com... When the page loads, you have to click the Start button to get the slide show running, but I'd like it to start running straight away without having to click.
Er,
<body ... onload="StartIt ()">
Cheers
Richard.
"rf" <ma**********@t he.time> wrote in message news:<kC******* *************@n ews-server.bigpond. net.au>... "TonyJeffs" <to*******@aol. com> wrote in message news:8e******** *************** ***@posting.goo gle.com... When the page loads, you have to click the Start button to get the slide show running, but I'd like it to start running straight away without having to click.
Er, <body ... onload="StartIt ()">
Cheers Richard.
Thanks
There's a logic to that!
Maybe I should buy a book to get me underway.
Does JS have public variables, and scope and stuff like that?
Tony This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Edward King |
last post by:
Hi!
I am trying to achieve the following:
I have a number of help pages (in the format help_nn.php where nn=helpid).
I want to be able to open a particular help page by calling the function
gethelp(nn) where nn is the helpid.
The function is contained in a header file called funcs.inc that each page
|
by: Yvan J. Gagnon |
last post by:
I am encountering a strange problem in Netscape 7 with a CFM file I am
trying to troubleshoot (the page is working fine in NS Communicator
and IE). Below is a sample of the problematic line of javascript code.
Note that in the actual file, I've surrounded the variable
'#cookie.cookiename#' with CFOUTPUT tags:
document.write('<input type="Hidden" name="affiliate"
value="#cookie.cookiename#">');
When I load the document in Netscape 7, I...
|
by: Dom |
last post by:
I have a frameset with a left right columns, called 'index' and
'content'.
The left column of the frameset ('index') loads an index.htm file
which have these hrefs (summarized the code a bit) for readability :
<a href="studio/index.htm" target=content id="studio"> studio </a>
<a href="bandw/index.htm" target=content id="bandw"> bandw </a>
<a href="arch/index.htm" target=content id="arch"> arch </a>
<a href="etc/index.htm" ...
|
by: JKop |
last post by:
Take the following simple function:
unsigned long Plus5Percent(unsigned long input)
{
return ( input + input / 20 );
}
Do yous ever consider the possibly more efficent:
|
by: shree |
last post by:
Hi all,
I'm trying to call javascript function via onLoad but running into a
problem. I would appreciate any help and suggestion.
My application is as follows. When a page loads, I want to check
whether the vistor has the site's cookie present in their browser. If
its not present, then to redirect user to a login page (script). If
the cookie is present, then the rest of the html page should load.
I'm able to get function to detect...
| |
by: finerrecliner |
last post by:
i'm trying to make an action listener that will display an alert box
when the user clicks anywhere on the page once, and then go back to
normal mouse behavior.
i have this:
<html><script type="text/javascript">
document.addEventListener('click',hello(),false);
function hello()
{
alert("hello world!")
|
by: Schmidty |
last post by:
Okay...I have another 'newbie' question;
I have a function that loads a page and the action is
$_SERVER;
In the form that is in a function(method?) within a class a variable
is passed back to a mysqli connection and database and updates the
database.
The problem is that when the page is reloaded it does not show the
updated information in the database with the $_SERVER. Why
is the page loaded with the same information? Is it cached...
|
by: Yi |
last post by:
I want to make a simple javascript widget, something looks like the
Google AdWords, that people can just post a small section of code on
their web page and display some content from my website.
I searched online and found many javascript tools and packages but all
seem to be building widgets for a widget platform. I want something
that anybody can just copy and paste on their web page no matter they
are using ASP.NET or html or PHP for...
|
by: jntmac |
last post by:
I cannot find the answer anywhere on the entire net:
I have an image on my website. The image shows a newsletter, and the image says "Click here to register to receive our newsletter".
I know how to make the image link to a url, but I don't want to do that. What I want to do is when you click on the image, it calls an external javascript function that brings up a popup where you enter your name and email address and submit. The external...
|
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...
|
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,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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();...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |