问题描述
我有一个表,其中使用以下代码可以很好地设置每行分配的小href链接:
I have a table in which there are small href links assigned in each row which i have set using below code working fine:
<a href="popup.php" onclick="javascript:void window.open('popup.php','1361166642895','width=700,height=500,toolbar=0,menubar=0,location=0,status=1,scrollbars=1,resizable=0,left=0,top=0');return false;"><h10>(check status)</h10></a>
现在,我不想显示与静态相同的上述href链接,而是希望将我的变量值发送到弹出窗口,并且需要获取每行分别显示的数据.简而言之,我想在弹出窗口中传递变量$name
.我正在尝试下面的代码,但没有发生.即使我尝试了GET
Now I do not want to display the same above href link as static but want to send my variable value to the pop window and need to get data displayed separately for each row.In short i want to pass my variable $name
in the popup window. I am trying below code but but isn't happening. Even i tried <FORM>
by GET
<?php echo "<a href=popup.php?id=",$name,"><h10>(check status)</h10></a>";?>
在popup.php页面上:
On popup.php page:
<?php echo $id = $_GET["id"]; ?>
我想要的是使用任何方法(GET或HREF)传递变量,它应该在新的弹出窗口中打开,而不是在下一个选项卡或转发的窗口中打开
What i want want is to pass variable using any method (GET or HREF), and it should open in new popup window not in next tab or forwarded window
推荐答案
更改此内容
<?php echo "<a href=popup.php?id=",$name,"><h10>(check status)</h10></a>";?>
到
<?php echo "<a target='_blank' href='popup.php?id=".$name."' onclick=\"window.open(this.href, 'popupwindow', width=400,height=300,scrollbars,resizable');return false;\"><h10>(check status)</h10></a>";?>
^ ^ ^ ^// here was the mistake
您没有正确连接字符串,并且错过了'
的herf
属性.
You have not concatenated the strings properly and you missed '
for herf
attribute.
使用target="_blank"
在新标签页或新浏览器中打开链接.
Use target="_blank"
for opening link in new tab or new browser.
这篇关于将变量传递到新的弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!