Hvorfor udskriver den ikke "næste side"?
Hej jeg har følgende side:<Script Language="JavaScript">
PositionX = 100;
PositionY = 100;
defaultWidth = 99;
defaultHeight = 86;
var AutoClose = true;
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
function popImage(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
writeln('width=100-(document.body.clientWidth-document.images[0].width);');
writeln('height=100-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');
writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');
close();
}}
</script>
<?
$dir = "galleri/";
// Det antal billeder der skal vises ad gangen
$antal = 9;
// Henter startnummeret.
$num = ($_GET['num']) ? (int) $_GET['num']-1 : 0;
function GetFileName($file) {
$part = explode(".", $file);
$file = "";
for($i=0;$i<count($part);$i++) {
$file = $file . $part[$i];
}
return $file;
}
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && $file != "Thumbs.db" && $file != "thumbs" && $file != "") {
$files[] = $file;
}
}
closedir($handle);
}
$td = 0;
sort($files);
echo "<center>";
// Tæller hvor mange filer der er
$antal_filer = sizeof($files);
// Sætter det næste og forrige nummer
$nextnum = $num+$antal+1;
$prevnum = $num-$antal;
// Tester om der skal laves en forrige eller næste link
if ($num >= $antal) echo "<a href='galleri.php?num=$prevnum'>Forrige $antal</a> ";
if ($antal_filer > $nextnum) echo "<a href='galleri.php?num=$nextnum'>Næste $antal</a>";
echo "</center>\n<table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" align=\"center\"> ";
for($i=$num;$i<$num+$antal;$i++){
$td++;
if($td == 1) {echo "<tr>\n"; }
// Tester om der er flere billeder at lave
if ($i<sizeof($files)){
?><style type="text/css">
<!--
body,td,th {
font-family: Arial;
font-size: 10px;
color: #000000;
font-weight: bold;
}
body {
background-color: #FFFFFF;
}
a {
font-size: 10px;
color: #000000;
font-weight: bold;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #000000;
}
a:hover {
text-decoration: none;
color: #000000;
}
a:active {
text-decoration: none;
color: #000000;
}
-->
</style>
<td align="center" width="25%">
<table cellpadding="0" cellspacing="5" align="left">
<tr>
<td align="center" style="border: 1px solid #ffffff;"><a href="java script:popImage('<? echo $dir.$files[$i]; ?>','<? echo $i; ?>')">
<img src="<? echo $dir.$files[$i]; ?>" border="0" width="119" height="103">
</a> </td>
</tr>
</table>
</td>
<?
}
if($td == 3) {echo "</tr>\n"; $td = 0;}
}
?>
hvorfor udskriver den ikke "næste $antal" og "forrige $antal" selvom at der er eks. 10 billeder i mappen "galleri" .. og den står til at vise kun 9 billeder pr. side?
