Forum Moderators: open
<?php include("session.php");?>
<HTML>
<HEAD>
<TITLE>...</TITLE>
<LINK REL=STYLESHEET HREF="style.css" TYPE="text/css">
<script language = "javascript" type="text/javascript" src="jsfunctions.js">
</script>
</HEAD>
<BODY>
<?php include("menu.html");?>
<div STYLE='position:absolute;top:170; left:220; '>
<?
// initialize counter
$count = 0;
// set directory name
$dir = "./flyers";
echo "<table width = '400'><tr>";
// open directory and parse file list
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
// iterate over file list
// print filenames
while (($filename = readdir($dh))!== false) {
if (($filename!= ".") && ($filename!= "..")) {
$pos = strstr($filename, 'Thumbs');
if ($pos == false) {
$count ++;
//echo $dir . "/" . $filename . "\n";
echo "<a class= 'gallery' href = ".$dir."/".$filename." TARGET='myiframe'>".$count."</a> ";
}
}
}
// close directory
closedir($dh);
}
}
echo "</tr>";
echo "<tr><td><p><br /></p></td></tr>";
echo "<tr><IFRAME id = 'myiframe' name = 'myiframe' frameborder = '0' WIDTH=400 HEIGHT=250 border='0' >If you can see this, your browser doesn't understand IFRAME.</A>";
echo "</IFRAME></tr>";
echo "</table>";
?>
</div>
<?
//Now close the recordset and the connection object
mysql_close();
?>
</BODY>
</HTML>
<script language="JavaScript" type="text/javascript">
function showimageinframe(imagelink,framename,width,height) {
/* function showimageinframe by Sathallrin */
var source = '<img width="'+width+'" height="'+height+'" src="'+imagelink+'" />';
var myframe = document.getElementById(framename).contentWindow.document;
myframe.open();
myframe.write(source);
myframe.close();
}
</script>
and then change your link to this:
echo "<a class= 'gallery' href = 'javascript:showimageinframe(".$dir."/".$filename.",'myiframe',350,250)'>".$count."</a> ";
You can change the height/width in the link as needed.
So, for example, this then gives me a link of:
javascript:showimageinframe(./gallery/a.jpg,myiframe,200,200);
However, this still throws an error of:
Line: 1
Char: 18
Error: Syntax
Code: 0
This error is in IE. Firefox doesn't show an error but nothing happens either.
Any ideas?