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

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

McKirahan

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

McKirahan

McKirahan said:
[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","sig.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;
}
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:[email protected]">[email protected]</a></p>
</body>
</html>
 
D

David. E. Goble

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
 

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,772
Messages
2,569,593
Members
45,111
Latest member
VetaMcRae
Top