ID选择器仅在第二个按钮单击时传递到弹出页面 [英] ID selector only passes onto pop-up page on 2nd button click

查看:87
本文介绍了ID选择器仅在第二个按钮单击时传递到弹出页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表单,onclick将结果(waybillno)传递给弹出页面,作为带有id选择器的URL。它仅在第二次单击时传递结果,并在第一次单击时发送带有URL的空选择器结果,这告诉我在设置变量之前传递了表单。我已经尝试将代码移动以强制变量先前创建但是没有帮助。任何帮助表示赞赏。

以下是代码: -



I have a form that onclick passes the result (waybillno) over to the popup page as a URL with the id selectors. It only passes the result on the 2nd click and sends an empty selector result with the URL on the first click, which tells me the form is being passed before the variable is set. I have tried moving the code up to force the variable to be "created earlier" but is has not helped. Any help appreciated.
Here is the code:-

<!DOCTYPE html>
<html lang="en">

<head>

</head>
<div class="container">

    <div class="row margin-10">
        <div class="col-md-4">
            <h4 class="orange-grad"><span class="white">WAYBILL UPDATES</span></h4>
            <form class="form-horizontal" role="form" action="popuptest.php" method="get">
                <input type="text" name="waybillno" class="search-query form-control col-md-6" placeholder="Waybill #">
                <button onclick="myFunction()">Go Now</button>

            </form>
        </div>
    </div>
</div>
<?php $id=$_GET['waybillno'];
echo $id;?>

    <script>
        function myFunction() {

            var myWindow = window.open("popuptest1.php?id=<?php echo $id=$_GET['waybillno'];?>", " ", "width = 1200, height = 400, top = 100, left = 300 ");
        }
    </script>

</html>





我的尝试:



移动myFunction脚本以查看代码的顺序是否有所不同。

我花了整整两天的时间研究,但是没有运气。



What I have tried:

Moving the myFunction script around to see if the order of code makes a difference.
I have spent two full days on t researching but with no luck.

推荐答案

id =


_GET ['waybillno'];
echo
_GET['waybillno']; echo


id;?>

< script>
函数myFunction(){

var myWindow = window.open(popuptest1.php?id =<?php echo
id;?> <script> function myFunction() { var myWindow = window.open("popuptest1.php?id=<?php echo


这篇关于ID选择器仅在第二个按钮单击时传递到弹出页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆