? use smilesImages[0]="smiles/007.gif" in <img id="sigsviewer" src=

  • Thread starter David. E. Goble
  • Start date
D

David. E. Goble

Hi All;

I have a few of these;

sigsImages[0]="sigs/finished1.jpg"
sigsImages[1]="sigs/foghorn.jpg"


lower I have;

<td align="center"><img id="sigsviewer" src="sigs/alien.gif"></td>

Can I use sigsImages[0] instead of "sigs/alien.gif"?
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
 
L

Lee

David. E. Goble said:
Hi All;

I have a few of these;

sigsImages[0]="sigs/finished1.jpg"
sigsImages[1]="sigs/foghorn.jpg"


lower I have;

<td align="center"><img id="sigsviewer" src="sigs/alien.gif"></td>

Can I use sigsImages[0] instead of "sigs/alien.gif"?

No. The lines above are Javascript. Those below are HTML.
The syntax looks similar, but you can't mix them.
 
M

McKirahan

Lee said:
David. E. Goble said:
Hi All;

I have a few of these;

sigsImages[0]="sigs/finished1.jpg"
sigsImages[1]="sigs/foghorn.jpg"


lower I have;

<td align="center"><img id="sigsviewer" src="sigs/alien.gif"></td>

Can I use sigsImages[0] instead of "sigs/alien.gif"?

No. The lines above are Javascript. Those below are HTML.
The syntax looks similar, but you can't mix them.

Actually you can but you probably wouldn't want to.

<td align="center">
<script type="text/javascript">
document.write('<img id="sigsviewer" src="' + sigsImages[0] + '">');
</script>
</td>

or

<script type="text/javascript">
document.write('<td align="center"><img id="sigsviewer" src="' +
sigsImages[0] + '"></td>');
</script>

It would only run in JavaScript-enabled browsers.
 
P

Paul Thompson

David. E. Goble said:
Hi All;

I have a few of these;

sigsImages[0]="sigs/finished1.jpg"
sigsImages[1]="sigs/foghorn.jpg"


lower I have;

<td align="center"><img id="sigsviewer" src="sigs/alien.gif"></td>

Can I use sigsImages[0] instead of "sigs/alien.gif"?
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

I have the same question, posted just after yours.

Essentially, we are both asking: How can I get all of those ABSOLUTE
REFERENCES out of my HTML, and into some .js or .css file which I can
manipulate them centrally? Right?
 
D

David. E. Goble

I have the same question, posted just after yours.

Essentially, we are both asking: How can I get all of those ABSOLUTE
REFERENCES out of my HTML, and into some .js or .css file which I can
manipulate them centrally? Right?

Right! My problem is I need to display a heap of pictures in a folder,
with server side includedes or cgi and I am too lazy to type each and
every1 lol.

However I did have to capture a dir listing into a file and write a c
program to read them in and warp them in htm then thru a program to
convert to js as below;

<!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="http://home.insightbb.com/clipart/backgrounds/bkgnd019.gif"
bgcolor="#ffffff" 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">Team
Special Forces</h2>
<SCRIPT src="sigsbody.js"></SCRIPT>
<P align="center">Then email it to us at <a
href="mailto:[email protected]">[email protected]</a></p>
</body>
</html>

//Generated By Easy HTML To Any Script Converter
document.writeln("<script type=\"text/javascript\">");
document.writeln("");
document.writeln("sigsImages=new Array()");
document.writeln("");
document.writeln("sigsImages[0]=\"finished1.jpg\"");
document.writeln("sigsImages[1]=\"foghorn.jpg\"");
document.writeln("sigsImages[2]=\"motto.jpg\"");
document.writeln("sigsImages[3]=\"sig.jpg\"");
document.writeln("sigsImages[4]=\"SWAT.jpg\"");
document.writeln("sigsImages[5]=\"title.gif\"");
document.writeln("");
document.writeln("sigscounter=sigsImages.length-1");
document.writeln("sigsi=0");
document.writeln("");
document.writeln("function sigsfirst()");
document.writeln("{");
document.writeln("document.getElementById(\'sigsviewer\').src=sigsImages[0]");
document.writeln("sigsi=0");
document.writeln("}");
document.writeln("");
document.writeln("function sigsprevious()");
document.writeln("{");
document.writeln("if (sigsi>0)");
document.writeln("{");
document.writeln("sigsi--");
document.writeln("document.getElementById(\'sigsviewer\').src=sigsImages[sigsi]");
document.writeln("}");
document.writeln("}");
document.writeln("");
document.writeln("function sigsnext()");
document.writeln("{");
document.writeln("if (sigsi<sigscounter)");
document.writeln("{");
document.writeln("sigsi++");
document.writeln("document.getElementById(\'sigsviewer\').src=sigsImages[sigsi]");
document.writeln("}");
document.writeln("}");
document.writeln("");
document.writeln("function sigslast()");
document.writeln("{");
document.writeln("document.getElementById(\'sigsviewer\').src=sigsImages[sigscounter]");
document.writeln("}");
document.writeln("");
document.writeln("<\/script>");

//Generated By Easy HTML To Any Script Converter
document.writeln("<center>");
document.writeln("<h1>sigs<\/h1>");
document.writeln("<form>");
document.writeln("<input value=\"First\" onclick=\"sigsfirst()\"
type=\"button\">");
document.writeln("<input value=\"Previous\" onclick=\"sigsprevious()\"
type=\"button\">");
document.writeln("<input value=\"Next\" onclick=\"sigsnext()\"
type=\"button\">");
document.writeln("<input value=\"Last\" onclick=\"sigslast()\"
type=\"button\">");
document.writeln("<\/form>");
document.writeln("<table border=\"1\">");
document.writeln("<tr>");
document.writeln("<td align=\"center\"><img id=\"sigsviewer\"
src=\"motto.jpg\"><\/td>");
document.writeln("<\/tr>");
document.writeln("<\/table>");
document.writeln("<p><\/p>");
document.writeln("<form>");
document.writeln("<input value=\"First\" onclick=\"sigsfirst()\"
type=\"button\">");
document.writeln("<input value=\"Previous\" onclick=\"sigsprevious()\"
type=\"button\">");
document.writeln("<input value=\"Next\" onclick=\"sigsnext()\"
type=\"button\">");
document.writeln("<input value=\"Last\" onclick=\"sigslast()\"
type=\"button\">");
document.writeln("<\/form>");
document.writeln("<p><\/p>");
document.writeln("<p>If you have a smilely<\/p>");
document.writeln("<\/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
 
D

David. E. Goble

It did not seem to work! Here are the three files I have;

//Generated By Easy HTML To Any Script Converter
document.writeln("<script type=\"text/javascript\">");
document.writeln("");
document.writeln("sigsImages=new Array()");
document.writeln("");
document.writeln("sigsImages[0]=\"finished1.jpg\"");
document.writeln("sigsImages[1]=\"foghorn.jpg\"");
document.writeln("sigsImages[2]=\"motto.jpg\"");
document.writeln("sigsImages[3]=\"sig.jpg\"");
document.writeln("sigsImages[4]=\"SWAT.jpg\"");
document.writeln("sigsImages[5]=\"title.gif\"");
document.writeln("");
document.writeln("sigscounter=sigsImages.length-1");
document.writeln("sigsi=0");
document.writeln("");
document.writeln("function sigsfirst()");
document.writeln("{");
document.writeln("document.getElementById(\'sigsviewer\').src=sigsImages[0]");
document.writeln("sigsi=0");
document.writeln("}");
document.writeln("");
document.writeln("function sigsprevious()");
document.writeln("{");
document.writeln("if (sigsi>0)");
document.writeln("{");
document.writeln("sigsi--");
document.writeln("document.getElementById(\'sigsviewer\').src=sigsImages[sigsi]");
document.writeln("}");
document.writeln("}");
document.writeln("");
document.writeln("function sigsnext()");
document.writeln("{");
document.writeln("if (sigsi<sigscounter)");
document.writeln("{");
document.writeln("sigsi++");
document.writeln("document.getElementById(\'sigsviewer\').src=sigsImages[sigsi]");
document.writeln("}");
document.writeln("}");
document.writeln("");
document.writeln("function sigslast()");
document.writeln("{");
document.writeln("document.getElementById(\'sigsviewer\').src=sigsImages[sigscounter]");
document.writeln("}");
document.writeln("");
document.writeln("<\/script>");

<!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="http://home.insightbb.com/clipart/backgrounds/bkgnd019.gif"
bgcolor="#ffffff" 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">Team
Special Forces</h2>
<SCRIPT src="sigsbody.js"></SCRIPT>
<P align="center">Then email it to us at <a
href="mailto:[email protected]">[email protected]</a></p>
</body>
</html>


//Generated By Easy HTML To Any Script Converter
document.writeln("<center>");
document.writeln("<h1>sigs<\/h1>");
document.writeln("<form>");
document.writeln("<input value=\"First\" onclick=\"sigsfirst()\"
type=\"button\">");
document.writeln("<input value=\"Previous\" onclick=\"sigsprevious()\"
type=\"button\">");
document.writeln("<input value=\"Next\" onclick=\"sigsnext()\"
type=\"button\">");
document.writeln("<input value=\"Last\" onclick=\"sigslast()\"
type=\"button\">");
document.writeln("<\/form>");
document.writeln("<table border=\"1\">");
document.writeln("<tr>");
document.writeln("<td align=\"center\"><img id=\"sigsviewer\"
src=\"motto.jpg\"><\/td>");
document.writeln("<\/tr>");
document.writeln("<\/table>");
document.writeln("<p><\/p>");
document.writeln("<form>");
document.writeln("<input value=\"First\" onclick=\"sigsfirst()\"
type=\"button\">");
document.writeln("<input value=\"Previous\" onclick=\"sigsprevious()\"
type=\"button\">");
document.writeln("<input value=\"Next\" onclick=\"sigsnext()\"
type=\"button\">");
document.writeln("<input value=\"Last\" onclick=\"sigslast()\"
type=\"button\">");
document.writeln("<\/form>");
document.writeln("<p><\/p>");
document.writeln("<p>If you have a smilely<\/p>");
document.writeln("<\/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
 
M

McKirahan

David. E. Goble said:
It did not seem to work! Here are the three files I have;

[snip}

Might I suggest this rewrite of our code?

This is little more readable / maintainable.

(I renamed "sigshead.js" from "sigsheader.js" -- I like 8.3 naming.)


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Bow's and foggy's stored signatures</title>
<script type="text/javascript" src="sigshead.js"></script>
</head>
<body
background="http://home.insightbb.com/clipart/backgrounds/bkgnd019.gif"
bgcolor="#ffffff" 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">Team
Special Forces</h2>
<script type="text/javascript" src="sigsbody.js"></script>
<P align="center">Then email it to us at <a
href="mailto:[email protected]">[email protected]</a></p>
</body>
</html>


var body = [
'<center>',
'<' + 'script type="text/javascript">',
'var sigsImages = new Array()',
' sigsImages[0] = "finished1.jpg"',
' sigsImages[1] = "foghorn.jpg"',
' sigsImages[2] = "motto.jpg"',
' sigsImages[3] = "sig.jpg"',
' sigsImages[4] = "SWAT.jpg"',
' sigsImages[5] = "title.gif"',
'var sigscounter = sigsImages.length-1',
'var sigsi = 0',
'function sigsfirst() {',
' document.getElementById("sigsviewer").src = sigsImages[0]',
' sigsi = 0',
'}',
'function sigsprevious() {',
' if (sigsi>0) {',
' sigsi--',
' document.getElementById("sigsviewer").src = sigsImages[sigsi]',
' }',
'}',
'function sigsnext() {',
' if (sigsi<sigscounter) {',
' sigsi++',
' document.getElementById("sigsviewer").src = sigsImages[sigsi]',
' }',
'}',
'function sigslast() {',
' document.getElementById("sigsviewer").src =
sigsImages[sigscounter]',
'}',
'',
'<' + '/script>'
].join('\n');
document.write(body);


var head = [
'<center>',
'<h1>sigs</h1>',
'<form>',
'<input value="First" onclick="sigsfirst()" type="button">',
'<input value="Previous" onclick="sigsprevious()" type="button">',
'<input value="Next" onclick="sigsnext()" type="button">',
'<input value="Last" onclick="sigslast()" type="button">',
'</form>',
'<table border="1">',
'<tr>',
'<td align="center"><img id="sigsviewer" src="motto.jpg"></td>',
'</tr>',
'</table>',
'<p></p>',
'<form>',
'<input value="First" onclick="sigsfirst()" type="button">',
'<input value="Previous" onclick="sigsprevious()" type="button">',
'<input value="Next" onclick="sigsnext()" type="button">',
'<input value="Last" onclick="sigslast()" type="button">',
'</form>',
'<p></p>',
'<p>If you have a smilely</p>',
].join('\n');
document.write(head);


I haven't look ed at the logic partly because i couldn't find the images.

Do you have a base URL for them?
 
D

David. E. Goble

var body = [
'<center>',
'<' + 'script type="text/javascript">',
...
].join('\n');
document.write(body);
Yes that does look better... thanks
I haven't look ed at the logic partly because i couldn't find the images.

Do you have a base URL for them?
http://home.insightbb.com/~bow.foggy/sigs/

Also how can I use (from sigshead.js);

sigsImages[ -- Random Number -- ]

In sigsbody.js, in particular on this line;

'<td align="center"><img id="sigsviewer" src="motto.jpg"></td>',

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
 
M

McKirahan

David. E. Goble said:
var body = [
'<center>',
'<' + 'script type="text/javascript">',
...
].join('\n');
document.write(body);
Yes that does look better... thanks

But I just tried it and the buttons don't work.
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

I added the following line after the body tag and it worked for me:

<base href="http://home.insightbb.com/~bow.foggy/sigs/">
 
D

David. E. Goble

David. E. Goble said:
var body = [
'<center>',
'<' + 'script type="text/javascript">',
...
].join('\n');
document.write(body);

Yes that does look better... thanks

But I just tried it and the buttons don't work.
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

I added the following line after the body tag and it worked for me:

<base href="http://home.insightbb.com/~bow.foggy/sigs/">
Well I cut n pasted from your post and added the abvoe line to the
main html file, but still the buttons do not work.
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
 
M

McKirahan

[snip]
Well I cut n pasted from your post and added the abvoe line to the
main html file, but still the buttons do not work.
Regards David. E. Goble

[snip]

You could post your code but you might try this instead:

<html>
<head>
<title>Bow's and foggy's stored signatures</title>
<script type="text/javascript">
var pics = new
Array("finished1.jpg","foghorn.jpg","motto.jpg","sig.jpg","SWAT.jpg","title.
gif");
var pict = 0;
function view(what) {
if (what == "<<") pict = 0;
else if (what == "<") if (pict > 0) pict--;
else if (what == ">") if (pict < pics.length-1) pict++;
else if (what == ">>") pict = pics.length-1;
document.getElementById("sigsviewer").src = pics[pict];
}
</script>
</head>
<body
background="http://home.insightbb.com/clipart/backgrounds/bkgnd019.gif"
bgcolor="#ffffff" link="#0000ff" text="#000000" vlink="#ff0000">
<base href="http://home.insightbb.com/~bow.foggy/sigs/">
<h1 align="center">Bow's and foggy's stored grahics</h1>
<h2 align="center" style="color: rgb(255, 0, 0);" color="red">Team Special
Forces</h2>
<center>
<h1>sigs</h1>
<form>
<input type="button" value="First" style="width:100px"
onclick="view('<<')">
<input type="button" value="Previous" style="width:100px"
onclick="view('<')">
<input type="button" value="Next" style="width:100px"
onclick="view('>')">
<input type="button" value="Last" style="width:100px"
onclick="view('>>')">
</form>
<table border="1">
<tr>
<td align="center"><img id="sigsviewer" src="motto.jpg"></td>
</tr>
</table>
<p></p>
<p></p>
<p>If you have a smilely</p>
<P align="center">Then email it to us at <a
href="mailto:[email protected]">[email protected]</a></p>
</body>
</html>

"getElementById()" is not supported by all browsers; what are you using?
 
M

McKirahan

[snip]
"getElementById()" is not supported by all browsers; what are you using?

Then why use it when document.images is widely supported?

<img name="sigsviewer".....>

document.images['sigsviewer'].src=.....

Let's go Randy's way:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Bow's and foggy's stored signatures</title>
<script type="text/javascript">
var pics = new
Array("finished1.jpg","foghorn.jpg","motto.jpg","sig.jpg","SWAT.jpg","title.
gif");
var pict = 0;
function view(what) {
if (what == "<<") {
pict = 0;
} else if (what == "<") {
if (pict > 0) pict--;
} else if (what == ">") {
if (pict < pics.length-1) pict++;
} else if (what == ">>") {
pict = pics.length-1;
}
document.images["sigsviewer"].src = pics[pict];
}
</script>
</head>
<body
background="http://home.insightbb.com/clipart/backgrounds/bkgnd019.gif"
bgcolor="#ffffff" link="#0000ff" text="#000000" vlink="#ff0000">
<base href="http://home.insightbb.com/~bow.foggy/sigs/">
<h1 align="center">Bow's and foggy's stored grahics</h1>
<h2 align="center" style="color: rgb(255, 0, 0);" color="red">Team Special
Forces</h2>
<center>
<h1>sigs</h1>
<form>
<input type="button" value="First" style="width:100px"
onclick="view('<<')">
<input type="button" value="Previous" style="width:100px"
onclick="view('<')">
<input type="button" value="Next" style="width:100px"
onclick="view('>')">
<input type="button" value="Last" style="width:100px"
onclick="view('>>')">
</form>
<table border="1">
<tr>
<td align="center"><img id="sigsviewer" src="motto.jpg"></td>
</tr>
</table>
<p></p>
<p></p>
<p>If you have a smilely</p>
<P align="center">Then email it to us at <a
href="mailto:[email protected]">[email protected]</a></p>
</body>
</html>

ALso, I revised "function view()" as it didn't seen to work!
 
D

David. E. Goble

"getElementById()" is not supported by all browsers; what are you using?
I am using netscape 7.2 and Ie x.whatever...

and your code, still did not work. I have ironed out all but this idea
I wanted to implement. Namely have a random pick of the avialable
pictures from the sigsImages[] array.

Thanks anyway.
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
 
D

David. E. Goble

[snip]
"getElementById()" is not supported by all browsers; what are you using?

Then why use it when document.images is widely supported?

<img name="sigsviewer".....>

document.images['sigsviewer'].src=.....

Let's go Randy's way:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Bow's and foggy's stored signatures</title>
<script type="text/javascript">
var pics = new
Array("finished1.jpg","foghorn.jpg","motto.jpg","sig.jpg","SWAT.jpg","title.
gif");
var pict = 0;
function view(what) {
if (what == "<<") {
pict = 0;
} else if (what == "<") {
if (pict > 0) pict--;
} else if (what == ">") {
if (pict < pics.length-1) pict++;
} else if (what == ">>") {
pict = pics.length-1;
}
document.images["sigsviewer"].src = pics[pict];
}
</script>
</head>
<body
background="http://home.insightbb.com/clipart/backgrounds/bkgnd019.gif"
bgcolor="#ffffff" link="#0000ff" text="#000000" vlink="#ff0000">
<base href="http://home.insightbb.com/~bow.foggy/sigs/">
<h1 align="center">Bow's and foggy's stored grahics</h1>
<h2 align="center" style="color: rgb(255, 0, 0);" color="red">Team Special
Forces</h2>
<center>
<h1>sigs</h1>
<form>
<input type="button" value="First" style="width:100px"
onclick="view('<<')">
<input type="button" value="Previous" style="width:100px"
onclick="view('<')">
<input type="button" value="Next" style="width:100px"
onclick="view('>')">
<input type="button" value="Last" style="width:100px"
onclick="view('>>')">
</form>
<table border="1">
<tr>
<td align="center"><img id="sigsviewer" src="motto.jpg"></td>
</tr>
</table>
<p></p>
<p></p>
<p>If you have a smilely</p>
<P align="center">Then email it to us at <a
href="mailto:[email protected]">[email protected]</a></p>
</body>
</html>

ALso, I revised "function view()" as it didn't seen to work!
Again, it the buttons don't seem to work in IE or netscape 7.2.

I am still looking for a way to change this

<td align="center"><img id="sigsviewer" src="motto.jpg"></td>

to something like;

<td align="center">
<img id="sigsviewer" src=pics[<-random number->]></td>

So that every time the page is refresh or visted, the starting picture
is different.
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
 
M

McKirahan

David. E. Goble said:
"getElementById()" is not supported by all browsers; what are you using?
I am using netscape 7.2 and Ie x.whatever...

and your code, still did not work. I have ironed out all but this idea
I wanted to implement. Namely have a random pick of the avialable
pictures from the sigsImages[] array.

Thanks anyway.
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

Here's a version that randomizes the initial image.

It works (for me) using IE5.5 and FF1.0 but not NS6.2.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Bow's and foggy's stored signatures</title>
<script type="text/javascript">
var pics = new
Array("finished1.jpg","foghorn.jpg","motto.jpg","sig.jpg","SWAT.jpg","title.
gif");
var pict = Math.round(Math.random()*(pics.length-1));
function view(what) {
if (what == "<<") {
pict = 0;
} else if (what == "<") {
if (pict > 0) pict--;
} else if (what == ">") {
if (pict < pics.length-1) pict++;
} else if (what == ">>") {
pict = pics.length-1;
}
document.images["sigsviewer"].src = pics[pict];
}
</script>
</head>
<body onload="view('')"
background="http://home.insightbb.com/clipart/backgrounds/bkgnd019.gif">
<base href="http://home.insightbb.com/~bow.foggy/sigs/">
<h1 align="center">Bow's and foggy's stored grahics</h1>
<h2 align="center" style="color:red">Team Special Forces</h2>
<center>
<h1>sigs</h1>
<form>
<input type="button" value="First" style="width:100px"
onclick="view('<<')">
<input type="button" value="Previous" style="width:100px"
onclick="view('<')">
<input type="button" value="Next" style="width:100px"
onclick="view('>')">
<input type="button" value="Last" style="width:100px"
onclick="view('>>')">
</form>
<table border="0">
<tr height="200">
<th><img id="sigsviewer" src="" style="border: solid 1px black"></th>
</tr>
</table>
<p>If you have a smilely</p>
<p align="center">Then email it to us at<a
href="mailto:[email protected]">[email protected]</a></p>
</body>
</html>
 
D

David. E. Goble

David. E. Goble said:
"getElementById()" is not supported by all browsers; what are you using?
I am using netscape 7.2 and Ie x.whatever...

and your code, still did not work. I have ironed out all but this idea
I wanted to implement. Namely have a random pick of the avialable
pictures from the sigsImages[] array.

Thanks anyway.
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

Here's a version that randomizes the initial image.

It works (for me) using IE5.5 and FF1.0 but not NS6.2.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Bow's and foggy's stored signatures</title>
<script type="text/javascript">
var pics = new
Array("finished1.jpg","foghorn.jpg","motto.jpg","sig.jpg","SWAT.jpg","title.
gif");
var pict = Math.round(Math.random()*(pics.length-1));
function view(what) {
if (what == "<<") {
pict = 0;
} else if (what == "<") {
if (pict > 0) pict--;
} else if (what == ">") {
if (pict < pics.length-1) pict++;
} else if (what == ">>") {
pict = pics.length-1;
}
document.images["sigsviewer"].src = pics[pict];
}
</script>
</head>
<body onload="view('')"
background="http://home.insightbb.com/clipart/backgrounds/bkgnd019.gif">
<base href="http://home.insightbb.com/~bow.foggy/sigs/">
<h1 align="center">Bow's and foggy's stored grahics</h1>
<h2 align="center" style="color:red">Team Special Forces</h2>
<center>
<h1>sigs</h1>
<form>
<input type="button" value="First" style="width:100px"
onclick="view('<<')">
<input type="button" value="Previous" style="width:100px"
onclick="view('<')">
<input type="button" value="Next" style="width:100px"
onclick="view('>')">
<input type="button" value="Last" style="width:100px"
onclick="view('>>')">
</form>
<table border="0">
<tr height="200">
<th><img id="sigsviewer" src="" style="border: solid 1px black"></th>
</tr>
</table>
<p>If you have a smilely</p>
<p align="center">Then email it to us at<a
href="mailto:[email protected]">[email protected]</a></p>
</body>
</html>
Mmmm that seems to work, if a bit slow... THanks. Any way of speeding
it up?
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
 
M

McKirahan

[snip]
Mmmm that seems to work, if a bit slow... THanks. Any way of speeding
it up?
Regards David. E. Goble

Have you added any images?
The six you had are pretty small.

Are you running locally?
Are you using a dial-up connection?

The images could be preloaded.

How's the speed when you run it by double-clicking on the filename in
Windows Explorer (presuming you're running Windows)?
 
M

McKirahan

McKirahan said:
[snip]
Mmmm that seems to work, if a bit slow... THanks. Any way of speeding
it up?
Regards David. E. Goble

The images could be preloaded.

Insert the following:

for (var i=0; i<pics.length; i++) {
var picx = new Image();
picx.src = pics;
}

immediate above: "function view(what) {"

How's the speed now?
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top