PopUp Recall

From: Date: Fri, 20 Dec 2002 07:34:49 +0000
Subject: PopUp Recall
Groups: php.general 
Request: Send a blank email to php-general+get-128956@lists.php.net to get a copy of this message
Hi; I have a PHP script that prints x number of products and related code to the generated HTML page. In that repeated code is a JavaScript that enables a pop-up window with an enlarged photo of a thumbnail image. The code printed to the JavaScript is dynamically generated in the loop and is correct. *However*, since the JavaScript has the same_name in all its renditions, when it's activated, it calls the last dynamically generated enlarged image, which is not necessarily the one the client cares to see. How do I keep my dynamic generation and get the correct photo to print? Is it possible to name functions differently via including an incremented variable? Here's my code: <?php // display the products $j=0; while( $fcp->next_record() ){ $flag1=(int)$fcp->f('prodflag1'); ?> <tr><td align=left valign=top colspan=1> <table width="100%" cellpadding=0 cellspacing=0 border=0> <tr><td align=left valign=top colspan=3> <?php if($fcp->f("prodpic")){ // show the product picture (if defined) /* width="<?php echo $fcp->f("prodpicw")?>" height="<?php echo $fcp->f("prodpich")?>" */ ?> <script language="javascript"> var photo = new String(); photo.src = "Jewelry.php?photo=<? echo ereg_replace('\.','%2E',htmlentities(urlencode($fcp->f("prodpic"))))?>&height=<? echo $fcp->f("prodpich")?>"; function popUp(here) {
        larimar = eval( here + ".src");
        newWindow = window.open(larimar,"","toolbar=0,menubar=0,width=500,height=450, scrollbars=1 ,status=0,location=0,dire
ctories=0,left=100,top=0"); } </script> <table border=0><tr><td align=center> <a href="#" onClick="popUp('photo')"><img src="<? echo $fcp->f("prodtpic")?>" width="<?php echo $fcp->f("prodtpicw")?>" height="<?php echo $fcp->f("prodtpich")?>" border=0 align=left></a><br clear=all> <i>Click image for enlargement.</i> </td></tr></table> So, how do I set an incrementor on popUp(here)? TIA, beno

« previous php.general (#128956) next »