简体   繁体   English

JavaScript弹出窗口无法从php父页面获得价值

[英]Javascript popup don't get value from php parent page

What I'm doing wrong? 我做错了什么?

This is the JavaScript code: 这是JavaScript代码:

    <script language="javascript">
    function popupIp(url) 
    {
    window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,
menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=350,height=320,screenX=150,
screenY=150,top=50,left=50')
    }
    </script>
    </head>

And here I call the popup: 在这里,我称弹出窗口为:

    <a href="#" <?='onclick="popupIp(\''.tep_href_link('ip-address-popup.php',  'ut='
 . $visit['bp_ip']), '&submit=Process' .'\'); return false;"';?>>
    <?php echo $visit["bp_ip"] . '</a>

I echo $visit["bp_ip"] and $ut on popup but there are no values. 我在弹出窗口上回显$visit["bp_ip"] and $ut ,但是没有值。

<?php
$popup = '<a href="#" onclick="popupIp(\'';
$popup .= tep_href_link('ip-address-popup.php', 'ut=' . $visit['bp_ip']);
$popup .= '&submit=Process\'); return false;">';
$popup .= $visit["bp_ip"];
$popup .= '</a>';
echo $popup;
?>

Your example had so many errors in it, hidden by putting it all into one unreadable line, that it took a while to unravel it. 您的示例中有很多错误,所有错误都被隐藏在一个不可读的行中,因此花了一段时间才将其解开。 One liners ALWAYS hide bugs and make code hard to read, it's a habit well worth breaking if you plan on doing more programming, particularly on a professional level. 一个内衬总是隐藏错误并使代码难以阅读,如果您打算进行更多编程,尤其是在专业水平上,这是一个值得打破的习惯。 Clean, debuggable, easy to read, code, that's the key. 干净,可调试,易于阅读的代码是关键。

I'm not 100% sure this is what you intended, but it's at least readable and debuggable so you can figure out what is happening. 我不是100%地确定这是您想要的,但是它至少是可读且可调试的,因此您可以了解正在发生的事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM