how to make php image link open in a new window

前端 未结 4 1014
被撕碎了的回忆
被撕碎了的回忆 2021-01-16 21:24

I had make a php link but i want it to open in a specific size in a new window.Can anyone from here suggest anything?The link is an image.

echo \"&         


        
相关标签:
4条回答
  • 2021-01-16 21:48

    To open in a new window, you have to add target to your a tag, eg:

    <a href="http://example.com" target="_blank">Example Link</a>
    

    To configure the size it's opened at, afaik you'd have to use javascript,

    <a href="http://example.com" onclick="window.open(this.href, '_blank', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;">Example Link</a>
    

    Here's a JS Fiddle

    0 讨论(0)
  • 2021-01-16 21:48

    I tried above code, but doesn't work. Instead of "_blank", I used "new"

    echo '<a href="www.google.com" target="new" > <img src="small.jpg"></a></div>';
    

    I'm not very sure about the quote. You may test out.

    0 讨论(0)
  • 2021-01-16 21:56

    Try this

    echo "<td><center><a target='_blank' href=\"edituser.php?id=$row[id]\"><img src=image/edit.png></a></center></td>";
    
    0 讨论(0)
  • 2021-01-16 21:58

    This should open it in a new window:

    <a target="_blank" href=\"edituser.php?id=$row[id]\"><img  width="200" height="150" src=image/edit.png></a>
    

    you can add "width" and "height" attributes to the "img" tag.

    0 讨论(0)
提交回复
热议问题