how to make php image link open in a new window

为君一笑 提交于 2019-12-30 13:56:12

问题


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 "<td><center><a href=\"edituser.php?id=$row[id]\"><img src=image/edit.png></a></center></td>";

the link is connect with the database.It will open a form to edit user data.


回答1:


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




回答2:


Try this

echo "<td><center><a target='_blank' href=\"edituser.php?id=$row[id]\"><img src=image/edit.png></a></center></td>";



回答3:


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.




回答4:


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.



来源:https://stackoverflow.com/questions/18870366/how-to-make-php-image-link-open-in-a-new-window

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!