Jump to content

1 line syntax help...


justAnoob

Recommended Posts

<?php
echo '<a href="' . $row['imgpath'] . '" 
onClick="window.open(' . $row['imgpath'] . '', width=350, height=350); return false">
<img src="' . $row['imgpath'] . '" width="150" alt="" border="0"></a>';
?>

 

These quotes and double quotes really get to me sometimes... Can someone help out?

Link to comment
Share on other sites

<?php
echo '<a href="' . $row['imgpath'] . '"     //197
onClick="window.open(\'".$row['imgpath']."\', width=350, height=350); return false">    //198
<img src="' . $row['imgpath'] . '" width="150" alt="" border="0"></a>';   //199
?>

 

error on line 198  expecting , or ;

 

this is what I got before.

Link to comment
Share on other sites

the code below works,, except for the size of the window that opens... It opens as a full screen browser window,,,I don't want that.

<?php
echo '<a href="' . $row['imgpath'] . '" 
      onClick="window.open("'.$row['imgpath'].'", width=350, height=350); return false">
      <img src="' . $row['imgpath'] . '" width="150" alt="" border="0"></a>';
?>

Link to comment
Share on other sites

Thanks,, I'll never get a reply in the javascript board.

 

That reminds me, you keep posting in the wrong section, you know thats against the terms!

Do take the time to post in the proper section.

 

The Javascript section does get replies (I also go their)

Link to comment
Share on other sites

I would go with what MadTechie posted in Reply#4, except there was an errant, extra single quote at the beginning of the image src attribute

 

<?php
echo "<a href=\"{$row['imgpath']}\" onClick=\"window.open('{$row['imgpath']}', width=350, height=350); return false\"><img src=\"{$row['imgpath']}\" width=\"150\" alt=\"\" border=\"0\"></a>";
?>

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.