Jump to content


This topic is now archived and is closed to further replies.


Passing extra variables to a popup

Recommended Posts

Good Morning!

I have close to NO knowledge in writing javascript. All of my experience has been using existing scripts and experimenting with changes til the desired result is achieved. That said here is the situation:

1. Photo gallery, thumbs are shown as links to a popup window that displays the large image. This works as it should.

2. I would like to be able to pass the variable containing the image's comments to the popup. I played around with appending the value to the end of the link; but no joy.

here is the code for the thumb display portion
<script language="Javascript">
function PopupPic(sPicURL) {
window.open ("popup.php?"+sPicURL, "", "resizable=1,HEIGHT=200,WIDTH=200");

more stuff, then ...
$what_line = explode("|",$the_array[$what_cell_2]);
$what_thumb = $what_line[2];
$what_image = $what_line[1];
$what_artist = $what_line[3];
$what_date = $what_line[0];
$what_title = $what_line[4];
$what_comments = $what_line[5];

<td align=center valign=top><a href="javascrip t:PopupPic('
<?PHP echo $what_image; ?>
')" ><?PHP echo $what_date;?><br><IMG SRC="
<?PHP echo $what_thumb; ?>
" border=0></a><br>
<?PHP echo $what_title; ?> </td>

this is the popup file

<TITLE>Our Family Photos</TITLE>
<script language='javascript'>
var arrTemp=self.location.href.split("?");
var picUrl = (arrTemp.length>0)?arrTemp[1]:"";
var NS = (navigator.appName=="Netscape")?true:false;

function FitPic() {
iWidth = (NS)?window.innerWidth:document.body.clientWidth;
iHeight = (NS)?window.innerHeight:document.body.clientHeight;
iWidth = document.images[0].width - iWidth;
iHeight = document.images[0].height - iHeight;
window.resizeBy(iWidth, iHeight+45);
<BODY bgcolor="#ffffff" onload='FitPic();' topmargin="0"
marginheight="0" leftmargin="0" marginwidth="0">
<script language='javascript'>
document.write( "<img src='" + picUrl + "' border=0>" );
<script language="javascript">
<input type=button value="Close This Window" onClick="javascript:window.close();">

Thanks in advance,


Share this post

Link to post
Share on other sites
In the second section, try changing the

$what_image = $what_line[1];


$what_image = $what_line[1]."&Comments=".$what_line[5];

and in the pop-up file add

<?PHP echo $_GET['Comments']; ?>

under the image

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.