Jump to content


Photo

Passing extra variables to a popup


  • Please log in to reply
1 reply to this topic

#1 litebearer

litebearer
  • Members
  • PipPipPip
  • Advanced Member
  • 2,357 posts
  • Locationwhite lake michigan

Posted 18 June 2006 - 11:52 AM

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");
}
</script>

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

<?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
?>


Thanks in advance,

Lite...


all the brothers were valiant!

[br][br]The truely intelligent people are not those who create the dots; rather they are they ones with the ability to connect the dots into a coherent picture

#2 nogray

nogray
  • Members
  • PipPipPip
  • Advanced Member
  • 930 posts
  • LocationSan Francisco CA

Posted 20 June 2006 - 04:54 PM

In the second section, try changing the

$what_image = $what_line[1];

to

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

and in the pop-up file add

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

under the image

NoGray.com





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users