Digital Point Forums
Moneygram

Go Back   Digital Point Forums > Design & Development > Programming > JavaScript
Google Analytics
Log In to view
your analytics

Reply
 
Thread Tools
  #1  
Old Jun 2nd 2005, 9:02 am
Grendor Grendor is offline
Peon
 
Join Date: Apr 2005
Posts: 8
Grendor is on a distinguished road
Simple image viewer

I want to make very simple page where I have two buttons(previous and next) and when I click on them the pictures change(forward and backward).
Shouldn't it be something like this:

<head>
function next() {
if (document.slideform.slide[current+1]) {
document.images.show.src = document.changer.slide[current+1].value;
document.changer.slide.selectedIndex = ++current;
}
function previous() {
if (current-1 >= 0) {
document.images.show.src = document.slideform.slide[current-1].value;
document.changer.slide.selectedIndex = --current;
</head>

<body>
<form name=changer>
<tr>
<td align=center bgcolor="#C0C0C0">
<input type=button onClick="previous();" value="<<" title="Previous">
<input type=button onClick="next();" value=">>" title="Next">
</td>
</tr>
</body>

Perhaps somebody has allready finished script to do this?
Reply With Quote
  #2  
Old Jun 2nd 2005, 9:48 am
mopacfan's Avatar
mopacfan mopacfan is offline
Starcaller
 
Join Date: May 2004
Location: Mizzery
Posts: 3,266
mopacfan is a name known to allmopacfan is a name known to allmopacfan is a name known to allmopacfan is a name known to allmopacfan is a name known to allmopacfan is a name known to all
If you're using asp, I have code I've written that does exactly that, but it's timed so it works like a slide show as well, with a pause button if you want to stop on a given image.
__________________
Police Lights - Amber Warning Lights - -
Reply With Quote
  #3  
Old Jun 2nd 2005, 9:53 am
Grendor Grendor is offline
Peon
 
Join Date: Apr 2005
Posts: 8
Grendor is on a distinguished road
Thanks, but it has to be in non-server script-javascript.
Reply With Quote
  #4  
Old Jun 2nd 2005, 9:58 am
mopacfan's Avatar
mopacfan mopacfan is offline
Starcaller
 
Join Date: May 2004
Location: Mizzery
Posts: 3,266
mopacfan is a name known to allmopacfan is a name known to allmopacfan is a name known to allmopacfan is a name known to allmopacfan is a name known to allmopacfan is a name known to all
Have you searched places like javascript.com or other tech sites for a script. I'm sure there must be dozens of them out there. I thought about using javascript, but I did not want to load large images in the background.
__________________
Police Lights - Amber Warning Lights - -
Reply With Quote
  #5  
Old Jun 5th 2005, 5:45 pm
somebody somebody is offline
Peon
 
Join Date: Jun 2005
Posts: 4
somebody is on a distinguished road
$img = new setarray(3);
$img[1] = "pic1a.jpg"; $img[2] = "pic2a.jpg"; $img[3] = "pic3a.jpg";

function setarray(n){
this.length = n; for (var i = 1; i <= n; i++); this[i] = 0; return this;
}

function fwd() {
if(ind < 6){
ind = ind + 1
var i2mod = document.getElementById('image'); i2mod.src = $img[ind];
}
}

function back() {
if(ind > 1){
ind = ind - 1
var i2mod = document.getElementById('image'); i2mod.src = $img[ind];
}
}

make your page buttons, use back() and fwd(), it works; to reset it, make button, have onclick be something like "ind=0;fwd();return true;"

questions? see my thread above yours, i still have questions!

=b
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can you use an image as a border option in CSS? NewComputer CSS 6 Aug 6th 2009 6:28 am
Image ads vs text ads - what is better in $ revenue hans AdSense 18 May 17th 2009 9:42 am
Checking source codes of image, audio and video files onauc Programming 0 Feb 21st 2005 5:34 pm
Centering an Image within a Block Element robert_neville CSS 1 Feb 12th 2005 7:13 pm
Setting up a linked image series Don Key HTML & Website Design 4 Nov 23rd 2004 1:58 pm


All times are GMT -8. The time now is 9:52 pm.