Help - easier way to load different pics ie er.jpg del.gif?

D

David. E. Goble

Hi all;

I have the following code;

var picssigs = new Array(
"sigs/finished1.jpg",
"sigs/foghorn.jpg",
"sigs/motto.jpg",
"sigs/sig.jpg",
"sigs/SWAT.jpg",
"sigs/title.gif"
);
var pictsigs = Math.round(Math.random()*(picssigs.length-1));
for (var i=0; i<picssigs.length; i++)
{
var imgsigs = new Image();
imgsigs.src = picssigs;
}

If I rename all the files as numbers ie 1.jpg, 2.jpeg, 3.gif. Can I
then some how load these.

Or would I first need to make sure they have the same extension.
Regards David. E. Goble
http://degoble.customer.netspace.net.au
degoble[AT]netspace.net.au
Po Box 648 (9 Murray St), Kingscote, Kangaroo Island SA 5223
 
D

David. E. Goble

Well thats a bugger as some of the pics are smaller in gif format,
while others look better in jpg.

Same extension, man.



David. E. Goble said:
Hi all;

I have the following code;

var picssigs = new Array(
"sigs/finished1.jpg",
"sigs/foghorn.jpg",
"sigs/motto.jpg",
"sigs/sig.jpg",
"sigs/SWAT.jpg",
"sigs/title.gif"
);
var pictsigs = Math.round(Math.random()*(picssigs.length-1));
for (var i=0; i<picssigs.length; i++)
{
var imgsigs = new Image();
imgsigs.src = picssigs;
}

If I rename all the files as numbers ie 1.jpg, 2.jpeg, 3.gif. Can I
then some how load these.

Or would I first need to make sure they have the same extension.
Regards David. E. Goble
http://degoble.customer.netspace.net.au
degoble[AT]netspace.net.au
Po Box 648 (9 Murray St), Kingscote, Kangaroo Island SA 5223


Regards David. E. Goble
http://degoble.customer.netspace.net.au
degoble[AT]netspace.net.au
Po Box 648 (9 Murray St), Kingscote, Kangaroo Island SA 5223
 
R

Random

Well, if you have a lot of them, you might consider building the Images
in two loops. Use one loop for *.jpg and one for *.gif.

Otherwise... it's only a few lines of code. I'd say leave it be.


David. E. Goble said:
Well thats a bugger as some of the pics are smaller in gif format,
while others look better in jpg.

Same extension, man.



David. E. Goble said:
Hi all;

I have the following code;

var picssigs = new Array(
"sigs/finished1.jpg",
"sigs/foghorn.jpg",
"sigs/motto.jpg",
"sigs/sig.jpg",
"sigs/SWAT.jpg",
"sigs/title.gif"
);
var pictsigs = Math.round(Math.random()*(picssigs.length-1));
for (var i=0; i<picssigs.length; i++)
{
var imgsigs = new Image();
imgsigs.src = picssigs;
}

If I rename all the files as numbers ie 1.jpg, 2.jpeg, 3.gif. Can I
then some how load these.

Or would I first need to make sure they have the same extension.
Regards David. E. Goble
http://degoble.customer.netspace.net.au
degoble[AT]netspace.net.au
Po Box 648 (9 Murray St), Kingscote, Kangaroo Island SA 5223


Regards David. E. Goble
http://degoble.customer.netspace.net.au
degoble[AT]netspace.net.au
Po Box 648 (9 Murray St), Kingscote, Kangaroo Island SA 5223
 
R

Random

1. Don't try to cache all of the images at once. Most people are still
not on broadband. Instead, try caching them two or three at a time.

2. Give the option of displaying a certain number of any one set of
images-- but only one set at a time, and only a fixed number. Don't
default to showing fifty animated gifs in one shot. Not only is it
irritating, but it plays hell on slower systems with older video cards
and has been known to aid in the diagnosis of elipesy at inopportune
times.

3. Display the images in an area of fixed size, so that clicking
'Next', 'Previous', et cetera don't cause the buttons to move.

4. Account for double-clicks on the buttons.

5. Try to compact it all so it fits on a single screen. It takes a
little more organisation, but it does a lot for the 'user experience'.
 
M

McKirahan

David. E. Goble said:
Ok well here is a link to my page;

http://bow.foggy.home.insightbb.com/test.htm

Any way of improving it. Either for readability and/or performance
wise?
Regards David. E. Goble
http://degoble.customer.netspace.net.au
degoble[AT]netspace.net.au
Po Box 648 (9 Murray St), Kingscote, Kangaroo Island SA 5223


Change the varying shaped button sizes to:

<input type="button" value="<<" title="First"
<input type="button" value="<" title="Previous"
<input type="button" value=">" title="Next"
<input type="button" value=">>" title="Last"

Or use CSS to assign a fixed width:

<input type="button" style="width:50px" value="<<" title="First"
<input type="button" style="width:50px" value="<" title="Previous"
<input type="button" style="width:50px" value=">" title="Next"
<input type="button" style="width:50px" value=">>" title="Last"

Or use CSS to fancy it up; (the first part goes above the </head> tag:

<style type="text/css">
..buttons {
background-color:#FFFFFF;
font-family:Arial,Helvetica;
width:50px;
}
</style>

<input type="button" class="buttons" value="<<" title="First"
<input type="button" class="buttons" value="<" title="Previous"
<input type="button" class="buttons" value=">" title="Next"
<input type="button" class="buttons" value=">>" title="Last"

Or use images instead of text.


What's with the questions that start with
"If you have a ..."
and don't even end with a question mark?

Also, it would be helpful to describe the page's purpose.
 
D

David. E. Goble

One problem is that if you click on reload or refresh the top part
does not reload the the pics.

Ok well here is a link to my page;

http://bow.foggy.home.insightbb.com/test.htm

Any way of improving it. Either for readability and/or performance
wise?
Regards David. E. Goble
http://degoble.customer.netspace.net.au
degoble[AT]netspace.net.au
Po Box 648 (9 Murray St), Kingscote, Kangaroo Island SA 5223

Regards David. E. Goble
http://degoble.customer.netspace.net.au
degoble[AT]netspace.net.au
Po Box 648 (9 Murray St), Kingscote, Kangaroo Island SA 5223
 
D

Dr John Stockton

JRS: In article <[email protected]>, dated
Tue, 24 May 2005 19:55:36, seen in David. E.
Goble said:
var picssigs = new Array(
"sigs/finished1.jpg",
"sigs/foghorn.jpg",
"sigs/motto.jpg",
"sigs/sig.jpg",
"sigs/SWAT.jpg",
"sigs/title.gif"
);
var pictsigs = Math.round(Math.random()*(picssigs.length-1));

Note that your pictsigs is not evenly distributed over the valid
indices; see clj FAQ 4.22.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top