Jump to content

Passing extra variables to a popup


litebearer

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
[code]
<script language="Javascript">
function PopupPic(sPicURL) {
window.open ("popup.php?"+sPicURL, "", "resizable=1,HEIGHT=200,WIDTH=200");
}
</script>
[/code]

more stuff, then ...
[code]
$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>
[/code]

this is the popup file

[code]<?PHP
session_start();
?>
<HTML>
<HEAD>
<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);
self.focus();
};
</script>
</HEAD>
<BODY bgcolor="#ffffff" onload='FitPic();' topmargin="0"
marginheight="0" leftmargin="0" marginwidth="0">
<script language='javascript'>
document.write( "<img src='" + picUrl + "' border=0>" );
</script>
<script language="javascript">
<!--
setTimeout("self.close();",10000)
//-->
</script>
<center>
<form>
<input type=button value="Close This Window" onClick="javascript:window.close();">
</form>
</center>
</BODY>
</HTML>
<?PHP
?>
[/code]


Thanks in advance,

Lite...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.