When clicking a thumbnail i would like the user to see a larger image in a new window. my open window function (javascript) is as follows:
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
function open_window(url) {
var NEW_WIN = null;
NEW_WIN = window.open ("", "RecordViewer","toolbar=no,width="+<?php echo $new_win_width ?>+",height="+<?php echo $new_win_height?>+",directories=no,status=no,scrollbars=yes,resize=yes,menubar=no");
NEW_WIN.location.href = url;
}
//-->
</SCRIPT>
the thumbnail is here:
<tr>
<td align="right" valign="top" bgcolor="#EFEFEF" width="200"><strong>photo:</strong></td>
<td bgcolor="#EFEFEF" width="300"><?php echo "<img src=\"$pictlarge\">" ?></td>
</tr>
Assuming that the larges image is called pictverylarge and that a query has been used to retrieve it from the database, how would I get the image in this new window when clicking the thumbnail. Undoubtfully I need to use an ahref tag and ca;; the open_window function but i am not too sure how to set it up. I am using an older version of php 4.03 in which superglobals are not relevant.
can anyone help?
thanks
hans
open window
Moderator: General Moderators
you might set the onClick()-property for the <img>-element.of course the strings someImgThumb.gif and someImg.gif would be provided by the php-script...
Code: Select all
<html>
<head>
<script type="text/javascript">
function doSomething(sUrl)
{
alert(sUrl);
}
</script>
<body>
<img src="someImgThumb.gif" onClick="javascript:doSomething('someImg.gif');"
style="width:100px; height:100px; cursor:pointer;" alt="someImgThumb.gif" />
</body>
</html>