【问题标题】:pass a form value to another form on a different page without using url variables (javascript)将表单值传递给不同页面上的另一个表单,而不使用 url 变量 (javascript)
【发布时间】:2009-10-09 23:21:53
【问题描述】:

我在页面上有一个表单,我想在不使用 URL 变量的情况下将表单输入框值传递给另一个页面上另一个表单上的另一个输入框 - 这可能吗?

如果有帮助的话,它们都共享相同的标题页部分。

谢谢

乔纳森

【问题讨论】:

    标签: javascript forms


    【解决方案1】:

    详细说明@BoltBait - 这是一个基本示例,使用JQuery + cookie plugin

    在第一页

    <script type="text/javascript">
        // set the cookie, on click to the next page
        $("#next-page").click(function() {
            $.cookie("INPUTBOX",$("input[name=inputbox]").val());
        });
    </script>
    

    然后在下一页

    <script type="text/javascript">
        // get the cookie, we are now on the next page
        alert($.cookie("INPUTBOX"));
    </script>
    

    希望对你有帮助

    【讨论】:

    • 谢谢 - 这真的很有帮助 - 非常感谢
    【解决方案2】:

    如果两个页面都在同一个网络服务器上,您可以使用 cookie 来实现。

    【讨论】:

      猜你喜欢
      • 2016-04-03
      • 1970-01-01
      • 2016-04-04
      • 2013-11-23
      • 1970-01-01
      • 2022-01-15
      • 2016-11-03
      • 1970-01-01
      相关资源
      最近更新 更多