如何在javascript的url中传递参数?

你NES

当我们单击链接时,我有一个 javascript 函数可以打开新窗口,但我想将值“id”传递到另一个页面。如何将值添加到 url> 以下是代码...

 <SCRIPT language="JavaScript1.2">
    function openoldgurantorwindow()
      {
     window.open("enter code heregurrantor/old",
    "mywindow","location=1,status=1,scrollbars=1,width=700,height=700");
    }
    </SCRIPT>
    <a href="javascript: openoldgurantorwindow()">Click to view old Guarantors</a> 

先感谢您。

洛夫普雷特·辛格

您可以传递id或任何其他参数作为查询参数,如下所示:

function openoldgurantorwindow(id) {
    window.open("http://example.com?id=" + id,
            "mywindow", "location=1,status=1,scrollbars=1,width=700,height=700");
}

并且可以PHP$_GET变量中的代码中在下一页检索

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章