如何在新窗口中打开PHP图像链接

问题描述 投票:0回答:4

我做了一个PHP链接,但我希望它在一个新窗口中打开一个特定的大小。可以从这里提出任何建议吗?链接是一个图像。

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

该链接与数据库连接。它将打开一个表单来编辑用户数据。

php html database image hyperlink
4个回答
4
投票

要在新窗口中打开,您必须将标记添加到标记中,例如:

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

要配置它打开的大小,afaik你必须使用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>

这是一个JS Fiddle


1
投票

试试这个

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

0
投票

这应该在一个新窗口中打开它:

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

您可以将“width”和“height”属性添加到“img”标记中。


0
投票

我试过上面的代码,但不起作用。而不是“_blank”,我使用“新”

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

我对这句话不太确定。你可以测试一下。

© www.soinside.com 2019 - 2024. All rights reserved.