deyuzhi
is_thinking
采纳率86%
2015-07-28 01:31 阅读 7.2k

请问使用button跳转页面时如何传递参数

html中有个变量为user.phone;有个点击函数为setpass
javascript代码如下:

 setPass: function() {
        window.location.href="setpass.vue?tel=%s" % this.user.phone;
    }

请问window.location.href="setpass.vue?tel=这里要如何写才能让this.user.phone传递过去呢?谢谢。

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

5条回答 默认 最新

  • 已采纳
    WebKernel SeeKernel 2015-07-28 01:57

    window.location.href = "setpass.vue?tel=" + user.phone

    点赞 2 评论 复制链接分享
  • u013222136 彬莫 2015-08-04 06:01
     <script type="text/javascript"> 
    function goToClient(username,password){ 
    window.location.href="client.jsp?username=" + username + "&password=" + password; 
    } 
    </script> 
    <a href="#" onclick="javascript:goToClient('u','p');">jsfdh</a> 
    
    点赞 2 评论 复制链接分享
  • yuke198907 yuke198907 2015-07-28 05:11

    "setpass.vue?tel=" + user.phone字符串拼接即可

    点赞 1 评论 复制链接分享
  • sina_2831808769 sina_2831808769 2015-07-28 12:59

    window.location.href = "setpass.vue?tel=" + user.phone

    点赞 评论 复制链接分享
  • u013222136 彬莫 2015-08-04 05:59
    function goToClient(username,password){ window.location.href="client.jsp?username=" + username + "&password=" + password; }

    jsfdh [转]

    点赞 评论 复制链接分享

相关推荐