Php is probably the easiest..... probably
This works...
PHP Code:
<?php
$imagearray[0] = 'src="FIRST IMG URL HERE" alt="FIRST IMG ALT HERE"';
$imagearray[1] = 'src="SECOND IMG URL HERE" alt="SECOND IMG ALT HERE"';
$imagearray[2] = 'src="THIRD IMG URL HERE" alt="THIRD IMG ALT HERE"';
$imagearray[3] = 'src="FOURTH IMG URL HERE" alt="FOURTH IMG ALT HERE"';
//Shouldn't need to edit past here
if(isset($_GET['img'])) {
$getval = $_GET['img'];
} else {
$getval = 0;
}
if(!is_numeric($getval)) {
die('<!DOCTYPE html><html><head></head><body>Invalid picture</body></html>');
}
if(!isset($imagearray[$getval])) {
die('<!DOCTYPE html><html><head></head><body>Invalid picture</body></html>');
}
$previous = $getval - 1;
$next = $getval + 1;
?>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<img <?php echo $imagearray[$getval]; ?> >
<br />
<?php
if($getval == 0) {
echo '<a href=""><input type="button" disabled="true" value="Previous"></a>';
} else {
echo '<a href="?img=' . $previous . '"><input type="button" value="Previous"></a>';
}
if($getval == count($imagearray) - 1) {
echo '<a href=""><input type="button" disabled="true" value="Next"></a>';
} else {
echo '<a href="?img=' . $next . '"><input type="button" value="Next"></a>';
}
?>
</body>
</html>
Tell me if you want me to explain anything...
Bookmarks