joeros Posted June 20, 2010 Share Posted June 20, 2010 i have the following code that i am trying to adapt. $x->addRowSelect("alert('You have selected id # %url%')"); /** * Adds ability to select a entire row * * @param string $onclick The JS function to call when a row is clicked */ public function addRowSelect($onclick) { $this->row_select = $onclick; } // Handle row selects if ($this->row_select) echo ' tbl-row-highlight" onclick="' . $this->parseVariables($row, $this->row_select); echo '">'; What happens is that when a row is clicked a pop window appears and gives the details of the specified field. What i am trying to do is have a window popup with a jpg picture instead. what i have done is this $x->addUrlSelect("href=(javascript:openpopup('tnail.jpg'))"); <script> function openpopup(popurl){ winpops=window.open(popurl,"","width=400,height=338,") } </script> public function adUrlSelect($openpopup) { $this->url_select = $openpopup; } Now as far as i can see everything is syntactically correct but is not working. Can anyone advise as to where i am going wrong please? as usual thanks for any replies Quote Link to comment Share on other sites More sharing options...
kratsg Posted June 20, 2010 Share Posted June 20, 2010 While this seems to be largely a javascript problem... My initial guess is to remove the "href=" portion of the addUrlSelect function.... Also, those extra parentheses don't make sense to me... how exactly is this being added to the URL? Quote Link to comment Share on other sites More sharing options...
joeros Posted June 20, 2010 Author Share Posted June 20, 2010 Hi, i removed the parentheses and fixed the spelling mistake (addUrl). still no work. as this is not originally my code the way i read is this, Addurlselect takes the url address to the openpopup function which 'should' create a jpg popup image but obviously does not. as i said i have read the original code and this is what it seems to do so i made what i thought was the appropriate changes Quote Link to comment Share on other sites More sharing options...
kratsg Posted June 20, 2010 Share Posted June 20, 2010 It might help to have the original code... otherwise, it's just shots in the dark. Quote Link to comment Share on other sites More sharing options...
joeros Posted June 20, 2010 Author Share Posted June 20, 2010 It might help to have the original code... otherwise, it's just shots in the dark. I agree and i have only been coding php for just over a week so i am very inexperienced, however i thought there was enough info there for a reasonable php programmer to steer me in the correct direction. Anyway, i have almost been able to work it out myself. All i needed to do was instead of duplicating code and changing parameters i just need to change this line $x->addRowSelect("alert('You have selected id # %url%')"); so that it becomes $x->addRowSelect("window.open('%url%')"); this opens the jpg in a new window but it is a full size window. i just want the thumbnail to open in a small window as a jpg. Any pointers? Quote Link to comment Share on other sites More sharing options...
kratsg Posted June 20, 2010 Share Posted June 20, 2010 http://www.javascript-coder.com/window-popup/javascript-window-open.phtml Change Height and Width by: (example) window.open ("http://www.javascript-coder.com", "mywindow","menubar=1,resizable=1,width=350,height=250"); To get height and width of image, you can use the getimagesize() function in PHP: http://php.net/manual/en/function.getimagesize.php Quote Link to comment Share on other sites More sharing options...
joeros Posted June 21, 2010 Author Share Posted June 21, 2010 Thankyou Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.