473,737 Members | 1,903 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

slide-show (random images)?

I would like to make a slide show using random images. The problem is my
host is 250.com, and they don't support cgi-programs. Is there another
way to accomplish random images?

Jul 23 '05 #1
9 12396
Michael Burtenshaw wrote:
I would like to make a slide show using random images. The problem is my
host is 250.com, and they don't support cgi-programs. Is there another
way to accomplish random images?

www.dynamicdrive.com

I thought 250.com went out of the hosting business.
Since I now get a website for "micropaten t".
Jul 23 '05 #2
Michael Burtenshaw wrote on 19 dec 2004 in comp.lang.javas cript:
I would like to make a slide show using random images. The problem is my
host is 250.com, and they don't support cgi-programs. Is there another
way to accomplish random images?


Clientside scripting, surely.

You uploading a different page every 5 minutes,
works as long as you don't fall asleep.

Serverside scripting, like ASP or PHP, if on your ISP.
[No, I don't want to have a look at your ISP's specs]

CGI-programming is not a primary method for such simple tasks, IMHO.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 23 '05 #3
On Sun, 19 Dec 2004 00:02:18 -0500, Mi************* **@webtv.net
(Michael Burtenshaw) wrote:
I would like to make a slide show using random images. The problem is my
host is 250.com, and they don't support cgi-programs. Is there another
way to accomplish random images?

Michael,

I have been working on a client-side script to automatically loop
though mulitple sets of images. Each slide is name with a sequential
number such as myImage1.jpg, myImage2.jpg myImage3.jpg. This
lets me us a "for loop" in the preload images into an Array, then I
can sequential step through the images by incrementing the counter
(currImg++). To randomly select the next image use....
currImg = Math.round(Math .random()*maxIm g)
Here is a greatly simplified example of my script. I have stripped
off a lot of functions/buttoms, such First, Last, Prev, FrameRate and
the ability for the user to select different set of images.

Good Luck,
Ron Beitel
//***** SlideShow_Rando m.html ******

<html>
<head>

// ron beitel, 20 Dec 2004

<script language="JavaS cript">

var delay = 500 // 1000 is 1 sec.
var currImg = 0 // index to the current image
var maxImg = 25 // default number of images (0 to 24)
var tid // timeout Id

var pix = new Array()

function preloadImgSet(m ax) {
for (i=0;i<max;i++) {
pix[i] = new Image()
pix[i].src = "http://250.com/yourPath/image_" + i + ".jpg"
}

nxtSlide()
}

function nxtSlide() {
clearTimeout(ti d)
currImg = Math.round(Math .random()*maxIm g)
document.images .Slide.src = pix[currImg].src
tid = setTimeout('nxt Slide()', delay)
}

function loop() {
tid = setTimeout('nxt Slide()', delay)
}

function stop() {
clearTimeout(ti d)
}

function next() {
currImg = Math.round(Math .random()*maxIm g)
document.images .Slide.src = pix[currImg].src
}

</script>

</head>

<body onLoad="preload ImgSet(maxImg)" >
<table border>
<tr><td colspan=2 align=center>
<h2>My Slide Show</h2>
<h3>Loop or Step Randomly</h3>
</td></tr>

<tr><td><tabl e border="0" cellpadding="0" cellspacing="0" >

<tr><td align="center">
<img src="" name='Slide'>
</td></tr>

<tr align="center"> <td>
<form name="buttons">
<input type="button" value="Loop" onclick="loop() "/>
<input type="button" value="Stop" onclick="stop() "/>
<input type="button" value="Next" onclick="next() "/>
</form>
</td></tr>

</table></td></tr>

</table>


</body>
</html>


Jul 23 '05 #4
On Sun, 19 Dec 2004 00:02:18 -0500, Mi************* **@webtv.net
(Michael Burtenshaw) wrote:
I would like to make a slide show using random images. The problem is my
host is 250.com, and they don't support cgi-programs. Is there another
way to accomplish random images?

Michael,

If you don't want to sequential number your filenames, change the

function preloadImgSet() {
pix[0] = new Image(); pix[0].src = "yourURL/imageA.jpg";
pix[1] = new Image(); pix[1].src = "yourURL/imageB.jpg";
pix[2] = new Image(); pix[2].src = "yourURL/imageC.jpg";

I didn't want to explicitly list the 500+ image files in my SlideShow.

Hope this helps,
Ron Beitel
Jul 23 '05 #5
JRS: In article <iu************ *************** *****@4ax.com>, dated
Tue, 21 Dec 2004 23:27:10, seen in news:comp.lang. javascript, Ron Beitel
<ro**@not.her e> posted :
To randomly select the next image use....
currImg = Math.round(Math .random()*maxIm g)


Bad code - see FAQ.

--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.c om/faq/> JL/RC: FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #6
On Wed, 22 Dec 2004 14:31:03 +0000, Dr John Stockton
<sp**@merlyn.de mon.co.uk> wrote:
JRS: In article <iu************ *************** *****@4ax.com>, dated
Tue, 21 Dec 2004 23:27:10, seen in news:comp.lang. javascript, Ron Beitel
<ro**@not.here > posted :
To randomly select the next image use....
currImg = Math.round(Math .random()*maxIm g)


Bad code - see FAQ.

Oops!

What Doctor John is either to busy or to arrogant to explain
is my use of Math.round() instead of Math.floor().

In my example, currImg gets a value between 0 and 25 inclusive.
But the Array of images holds 25 images, numbered 0 to 24.

0 <= Math.round(Math .random()*x) <= x
0 <= Math.floor(Math .random()*x) < x
Also apparently some browsers (i.e. Opera) don't implement
the random function and return [0 .. 1.0] instead of [0 .. 1.0).
Use a modulus 1 to gaurd against this. So change the lines...

currImg = Math.floor((Mat h.random() % 1) * maxImg)


Jul 23 '05 #7
JRS: In article <v5************ *************** *****@4ax.com>, dated
Thu, 23 Dec 2004 02:10:58, seen in news:comp.lang. javascript, Ron
Beitel <ro**@not.her e> posted :
On Wed, 22 Dec 2004 14:31:03 +0000, Dr John Stockton
<sp**@merlyn.d emon.co.uk> wrote:
JRS: In article <iu************ *************** *****@4ax.com>, dated
Tue, 21 Dec 2004 23:27:10, seen in news:comp.lang. javascript, Ron Beitel
<ro**@not.her e> posted :
To randomly select the next image use....
currImg = Math.round(Math .random()*maxIm g)


Bad code - see FAQ.

Oops!

What Doctor John is either to busy or to arrogant to explain
is my use of Math.round() instead of Math.floor().


When you use Math.round in that manner, you are not choosing at random.
The first and last options are only half as probable as the others.
Choosing at random, which is what the OP asked for, and what your
comment claims that you are doing, means that all possibilities must be
substantially equi-probable.

Posting an answer without a sufficient understanding of a newsgroup's
regularly-posted FAQ shows either arrogance or ignorance.

The regulars, of course, all know why it is bad code. The others should
read the FAQ. That is why we have a FAQ.

--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.c om/faq/> JL/RC: FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #8
ron


Sorry!

I should not have been so rude, but I was annoyed by your curt reply.
Bad code - see FAQ.

This was not that helpful. It is true, I just started visiting here
last week. And until I saw the footer on your reply, I did not know
where to find the FAQ. I must say they are very informative. I was
really impressed and bookmarked them. I am sure they will be a great
asset as I try to learn JavaScript.

Your explanation was much more helpful, and I immediately understood
the your point.
When you use Math.round in that manner, you are not choosing at random.
The first and last options are only half as probable as the others.
Choosing at random, which is what the OP asked for, and what your
comment claims that you are doing, means that all possibilities must be
substantiall y equi-probable.


Since, at first, I misunderstood your reasoning, perhaps my irritation
was justified. I thought your objection was the possibility of
Math.round(...) giving 25, while pix[25] did not exist. I was more
embarassed by this novice mistake, then the fact that the
nonsequential display of slides would not be statistically random.

Finally, I must object to the implication that only the masters may
contribute here. I alway found a seminar more stimulating then a
lecture. Certianly, this dialog has thought me two important
lessions--the proper way to find a random number and to keep my foot
out of my mouth. I only posted my solution, because a previous reply
indicated it was necessary to use some server-side technique. Since I
am currently writing a script to sequentially loop through a set of
images, I checked either Goodman's or Flaganan's book for
Math.random(), and quickly modified currImg++. In the future, I
promise to think, proof-read and test before posting. (That reminds
me, I need to take a red pen to that book. I'm sure the example used
Math.round())

Please accept my apology and thanks.

Ron

Jul 23 '05 #9
JRS: In article <n9************ *************** *****@4ax.com>, dated
Thu, 23 Dec 2004 23:08:51, seen in news:comp.lang. javascript, ron
<ro*@bebop.in n> posted :

I should not have been so rude, but I was annoyed by your curt reply.


Longwindedness is an American custom not favoured elsewhere.

--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 MIME. ©
Web <URL:http://www.merlyn.demo n.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demo n.co.uk/programs/> - see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.
Jul 23 '05 #10

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

Similar topics

1
4329
by: ajay | last post by:
I have following code for a slide menu but i twiked it to work for a single level menu. Open it in a Browser to get a clear picture. I have 2 Qs 1) How to make first entry as non-link. i.e i want to make first text as Table Heading/menu category. For examle in the given menu i want to make a heading as "Comp. Languages" which won't be a link. 2) The position of this menu is absolute to the page. I want to make it absolute to the Table...
0
568
by: Ata | last post by:
Hello, I am trying to copy the contents of the output of SQL Reporting Services to a PowerPoint slide. For this, I am using SQL Reporting Services to obtain an IMAGE stream, which I paste to the Windows clipboard. Then, using automation, I am trying to copy this information from the clipboard to a PowerPoint slide. However, I get an error at slide.Shapes.PasteSpecial. I am able create a System.Drawing.Bitmap object from the memory...
2
10212
by: WillRead | last post by:
I have a VB.Net application and a PowerPoint presentation explaining how each form in the application works, etc.. I would like to select and display the slide appropriate for each form by pressing the F1 key. In other words, I want to use the powerpoint presentation for my help system. I am calling the SlideShow from the applications menu, and it works great; however, the same techniques are not working for selecting individual slides. ...
1
1428
by: Ganesh | last post by:
Where to find a right sided slide-in JavaScript? My idea is something like this http://www.dynamicdrive.com/dynamicindex1/davidmenu.htm But I need it right-sided, not left-sided... tia
0
2129
by: redneon | last post by:
I'm trying to create a simple slide panel. Basically, what I've done is put a load of controls on a usercontrol and added this to a tabpage. The tabpage's height is 0 and when you move the mouse over the tab it uses a timer and increases the height of the tabpage by 1 every millisecond until the control reaches it's height. This way you get a slide effect. The problem is, when the control reaches a height of 1 it's time to draw the...
1
2281
by: bsg92150 | last post by:
i have a task that requires me to provide a web use with the ability to send teh current page to a power point slide. and to further complicate matters. the user may want to put the whole site into a slide. the problem is that the information is database driven and the user may not have visted the pages tha/ thankst he is requestion to download. my question is is this possable and is there an example out there that i can look at
0
2032
by: akshar108 via DotNetMonster.com | last post by:
Hi, I have aspose slide component and i want to take all string in the presentation's all slide but that component not give any method to get that direct we have to take all shape's textframe and then take text i do that things and then count words but i not get true word count can any one say me the technique to get that or give me any code for that my code is following Try Dim lic As Aspose.Slides.License = New Aspose.Slides.
16
6678
by: nagmvs | last post by:
Hi, Can any one tell me How to disable Keyboard Functions using JavaScript.If knows please tell me the code.Also tell me the code for mouse disable also. Thanks, Nagesh.
7
4403
by: metaphysics | last post by:
For a portfolio I am trying to make, I would like to be able to have a couple thumbnails on the page, that, when clicked, cause a box to horizontally slide in above the thumbnails. I am looking to achieve an effect similar to the one found here: Programming Articles - PHP Scripts, Articles, Tutorials - roScripts, with some minor changes. Instead of arrows to scroll to the next content, I would like thumbnails to trigger the change in...
0
8966
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
8786
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
9467
Oralloy
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...
0
9331
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
9257
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9204
tracyyun
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...
0
6052
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();...
1
3278
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
2744
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.