using this code, how can I change the javascript function name from load to load1(), load2()….
my user(s) can upload photos, and this javascript opens the photos up in a new window, but the photos all have href=”javascript:load()” this will make all the windows the size, with the same image. I want it to display the correct image, using the right function to open the window.
[code=php]$files = glob(‘images/photos/*.*’);
if(count($files))
{
echo ‘<table>’;
if (isset($_SESSION[user])){
echo ‘<form action=”index.php?page=delete” method=”post”><tr>’;
}
$counter = 0;
foreach($files as $path)
{
if(!(++$counter % 4))
{
echo “</tr>n<tr>”;
}
$image = “$path”;
$size = GetImageSize($image);
$width=$size[0];
$height=$size[1];
$filename = basename($path);
$directory = dirname($path);
$width=$width + 20;
$height=$height + 20;
echo”
<Script Language=”JavaScript”>
function load() {
var load = window.open(‘$path’,”,’scrollbars=yes,menubar=no,height=$height,width=$width,resizable=no,toolbar=no,location=no,status=no’);
}
</Script>
“;
echo “<td><a href=’javascript:load()’ alt=”><img border=’0′ src=’$directory/thumbs/$filename’></a>”;
if (isset($_SESSION[user])){
echo ‘<br><input type=”checkbox” name=”delete[]” value=”‘.$filename.'”> Delete Photo’;
}
echo”</td>n”;
}
if (isset($_SESSION[user])){
echo ‘</tr><tr><td colspan=”3″><input type=”submit” value=”Delete”></td></tr></form></table>’;
}else{
echo”</table>”;
}
}