0

I have this code in my site and I would like to control the size of the _target window. I believe I need to use onClick but I am not sure. Newbie here.

      <td class="recordCells"><?php echo '<a href="inventory/' . $row_rsInventory['PHOTO'] . '" target="_blank">' . '<img src="images/a-camera-icon.png"/>' . '</a>'; ?></td>          
Steve D
  • 33
  • 1
  • 6

3 Answers3

0

Yes, you're right about having to use onClick.

Your code should look like this:

<td class="recordCells">
    <?php echo '<a href="inventory/' . $row_rsInventory['PHOTO'] . '" target="_blank" onClick="window.open(this.href, \'mywin\', \'width=500,height=500\'); return false;">' . '<img src="images/a-camera-icon.png"/>' . '</a>'; ?>
</td>

The slashes are for escaping the quotes, the rest is kind of self-explanatory. 'mywin' is the identifier for the window, in case you want to change the content later. We're returning false in the function, so the default click functionality is overriden.

TemporaryName
  • 487
  • 5
  • 16
0

You can use javascript open(). By changing width and height you can adjust window size.

check https://jsfiddle.net/24sck8rs/7/

Rohit
  • 1,794
  • 1
  • 8
  • 16
0

http://www.w3schools.com/jsref/met_win_open.asp

Create a click event on the element you want to click ie onclick="OpenWindow(URL_Parameter);".

Then, Create a script tag and a javascript function called OpenWindow()

<script type="text/javascript">
    function OpenWindow(URL){
        window.open(URL,name,specs,replace)
    }
</script>

On the .Open() method, you can pass window sizes:

window.open(URL, "name", "width=200,height=100");
Ben
  • 1,820
  • 2
  • 14
  • 25