473,503 Members | 1,858 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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
Jul 23 '05 #1
22 2504
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.

Jul 23 '05 #2
"Lee" <RE**************@cox.net> wrote in message
news:ct*********@drn.newsguy.com...
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.
Jul 23 '05 #3
David. E. Goble wrote:
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?
Jul 23 '05 #4
>
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:Bo*******@insightbb.com">Bo*******@in sightbb.com</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(\'sigsvi ewer\').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(\'sigsvi ewer\').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(\'sigsvi ewer\').src=sigsImages[sigsi]");
document.writeln("}");
document.writeln("}");
document.writeln("");
document.writeln("function sigslast()");
document.writeln("{");
document.writeln("document.getElementById(\'sigsvi ewer\').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
Jul 23 '05 #5
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(\'sigsvi ewer\').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(\'sigsvi ewer\').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(\'sigsvi ewer\').src=sigsImages[sigsi]");
document.writeln("}");
document.writeln("}");
document.writeln("");
document.writeln("function sigslast()");
document.writeln("{");
document.writeln("document.getElementById(\'sigsvi ewer\').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:Bo*******@insightbb.com">Bo*******@in sightbb.com</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
Jul 23 '05 #6
"David. E. Goble" <de*****@gtech.computing> wrote in message
news:hh********************************@4ax.com...
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:Bo*******@insightbb.com">Bo*******@in sightbb.com</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?
Jul 23 '05 #7
On Tue, 1 Feb 2005 13:48:10 -0600, "McKirahan" <Ne**@McKirahan.com>
wrote:
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
Jul 23 '05 #8
On Wed, 02 Feb 2005 22:55:10 +1030, David. E. Goble
<de*****@gtech.computing> wrote:
On Tue, 1 Feb 2005 13:48:10 -0600, "McKirahan" <Ne**@McKirahan.com>
wrote:
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
Jul 23 '05 #9
"David. E. Goble" <de*****@gtech.computing> wrote in message
news:0u********************************@4ax.com...
On Wed, 02 Feb 2005 22:55:10 +1030, David. E. Goble
<de*****@gtech.computing> wrote:
On Tue, 1 Feb 2005 13:48:10 -0600, "McKirahan" <Ne**@McKirahan.com>
wrote:
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/">
Jul 23 '05 #10
On Wed, 2 Feb 2005 07:07:33 -0600, "McKirahan" <Ne**@McKirahan.com>
wrote:
"David. E. Goble" <de*****@gtech.computing> wrote in message
news:0u********************************@4ax.com.. .
On Wed, 02 Feb 2005 22:55:10 +1030, David. E. Goble
<de*****@gtech.computing> wrote:
>On Tue, 1 Feb 2005 13:48:10 -0600, "McKirahan" <Ne**@McKirahan.com>
>wrote:
>>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
Jul 23 '05 #11
"David. E. Goble" <de*****@gtech.computing> wrote in message
news:9o********************************@4ax.com...

[snip]
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


[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","s ig.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:Bo*******@insightbb.com">Bo*******@in sightbb.com</a></p>
</body>
</html>

"getElementById()" is not supported by all browsers; what are you using?
Jul 23 '05 #12
McKirahan wrote:
"David. E. Goble" <de*****@gtech.computing> wrote in message
news:9o********************************@4ax.com...

[snip]
<--snip-->
document.getElementById("sigsviewer").src = pics[pict];
}
<--snip-->
<td align="center"><img id="sigsviewer" src="motto.jpg"></td>
<--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=.....

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #13
"Randy Webb" <Hi************@aol.com> wrote in message
news:k_********************@comcast.com...

[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=.....

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq


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","s ig.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:Bo*******@insightbb.com">Bo*******@in sightbb.com</a></p>
</body>
</html>

ALso, I revised "function view()" as it didn't seen to work!
Jul 23 '05 #14
On Wed, 2 Feb 2005 12:14:41 -0600, "McKirahan" <Ne**@McKirahan.com>
wrote:

"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
Jul 23 '05 #15
On Wed, 2 Feb 2005 16:24:30 -0600, "McKirahan" <Ne**@McKirahan.com>
wrote:
"Randy Webb" <Hi************@aol.com> wrote in message
news:k_********************@comcast.com...

[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=.....

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq


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:Bo*******@insightbb.com">Bo*******@in sightbb.com</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
Jul 23 '05 #16
"David. E. Goble" <de*****@gtech.computing> wrote in message
news:ov********************************@4ax.com...
On Wed, 2 Feb 2005 12:14:41 -0600, "McKirahan" <Ne**@McKirahan.com>
wrote:

"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","s ig.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:Bo*******@insightbb.com">Bo*******@in sightbb.com</a></p>
</body>
</html>
Jul 23 '05 #17
On Wed, 2 Feb 2005 20:49:41 -0600, "McKirahan" <Ne**@McKirahan.com>
wrote:
"David. E. Goble" <de*****@gtech.computing> wrote in message
news:ov********************************@4ax.com.. .
On Wed, 2 Feb 2005 12:14:41 -0600, "McKirahan" <Ne**@McKirahan.com>
wrote:
>
>"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:Bo*******@insightbb.com">Bo*******@in sightbb.com</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
Jul 23 '05 #18
"David. E. Goble" <de*****@gtech.computing> wrote in message
news:oa********************************@4ax.com...

[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)?

Jul 23 '05 #19
"McKirahan" <Ne**@McKirahan.com> wrote in message
news:qJ********************@comcast.com...
"David. E. Goble" <de*****@gtech.computing> wrote in message
news:oa********************************@4ax.com...

[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[i];
}

immediate above: "function view(what) {"

How's the speed now?
Jul 23 '05 #20
"McKirahan" <Ne**@McKirahan.com> wrote in message
news:i4********************@comcast.com...

[snip]

You might want to add this as the last line in the function:

window.status = "Picture " + (pict+1) + " of " + pics.length;

This will indicate "Picture # of #" on the browser's status bar.

(You may want to change it to "Image # of #".)

This will advise the user:
a) to not press "First" or "Previous" if it's "1 of 1" or
b) to not press "Next" or "Last" if it's "6 of 6".

Another approach would be to disable "invalid" buttons.
Jul 23 '05 #21
"McKirahan" <Ne**@McKirahan.com> wrote in message
news:7o********************@comcast.com...
"McKirahan" <Ne**@McKirahan.com> wrote in message
news:i4********************@comcast.com...

[snip]

Another approach would be to disable "invalid" buttons.


Okay, here's a version with this feature too.

It works in IE and FF but not NS; see
http://www.quirksmode.org/js/cssdisable.html
<!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","s ig.jpg","SWAT.jpg","title.
gif");
var pict = Math.round(Math.random()*(pics.length-1));
for (var i=0; i<pics.length; i++) {
var img = new Image();
img.src = pics[i];
}
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];
window.status = "Picture " + (pict+1) + " of " + pics.length;
//
document.getElementById("F").disabled = false;
document.getElementById("P").disabled = false;
document.getElementById("N").disabled = false;
document.getElementById("L").disabled = false;
if (pict == 0) {
document.getElementById("F").disabled = true;
document.getElementById("P").disabled = true;
} else if (pict == pics.length-1) {
document.getElementById("N").disabled = true;
document.getElementById("L").disabled = true;
}
}
</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" id="F" style="width:100px"
onclick="view('<<')">
<input type="button" value="Previous" id="P" style="width:100px"
onclick="view('<')">
<input type="button" value="Next" id="N" style="width:100px"
onclick="view('>')">
<input type="button" value="Last" id="L" 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:Bo*******@insightbb.com">Bo*******@in sightbb.com</a></p>
</body>
</html>
Jul 23 '05 #22

Oh Man, that is sooo cool. Thanks that's exactally what I wanted to do
and a bit more cleaner than my partial solution.
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 #23

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

Similar topics

1
3263
by: j erickson | last post by:
with the following xsl and xml file, the display of the gif file with the <image/url> tag works. However, the gif file in the <description> tag using the name attribute "src" won't make the correct...
7
3669
by: Scott | last post by:
Hello All, I've been reading all of the various issues with Iframes in netscape. I have tried all of the various fixes posted, and have even implemented both an iframe and ilayer. My problem is...
2
482
by: wylbur37 | last post by:
I normally use Mozilla 1.4 on Windows XP Pro. As I was developing some test webpages, I discovered that the SRC parameter doesn't seem to work when a path is used with the filename. In one...
14
2468
by: Brandon Hoppe | last post by:
I'm trying to change the src of an ilayer in the parent document from a link inside the ilayer. I'm not able to get it to work. All that happens is Netscape 4 crashes. This is for Netscape 4 only....
0
6065
by: Martin | last post by:
I understand that as of IE5.5 iframes respect the z-index style property. However I have noticed some odd behaviour when the iframe's src is set to an MHT web archive instead of an HTML file. ...
12
1732
by: A.M | last post by:
Hi, Using VS.NET 2003, If i use SRC page attribute instead of CodeBehind, do i still have intelisence and generally IDE support for that? Thanks, Ali
5
7078
by: euronay | last post by:
Hi I'm pretty rubbish at java and I'm trying to get an image to change when a user clicks a link. I don't know why this doesn't work. Can anyone help? ...
4
1919
by: shawn | last post by:
I have a simple script located here which loads different images when you click on some links. Everything works fine until you click on the last link which opens a popup window (zoom image). ...
3
2277
by: kansaschuck | last post by:
Ok... Let me start over since I had miss labeled the other question and it ended up in phpland and I failed to follow the posting rules. Sorry, here's a rework. (hey... I just saw the html code...
1
38701
by: mhito | last post by:
hi guys, My first post yes. Thanks for all the nice posts and threads in this forum - great stuff. Now, here's my question: First off, the url : http://catfish.businesscatalyst.com/bcimg.htm...
0
7202
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,...
0
7280
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,...
0
7330
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...
1
6991
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...
0
7460
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...
0
5578
agi2029
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,...
1
5014
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...
0
4672
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...
0
3167
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...

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.