dro62273 2015-10-07 16:05
浏览 29

Javascript弹出窗口没有从php父页面获取值

What I'm doing wrong?

This is the JavaScript code:

    <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.

  • 写回答

1条回答 默认 最新

  • dougang5088 2015-10-07 18:48
    关注
    <?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.

    评论

报告相同问题?

悬赏问题

  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100