使用javascript在HREF中未设置值

时间:2015-08-10 08:06:34

标签: javascript href

使用的库:<script src="https://cdnjs.cloudflare.com/ajax/libs/URI.js/1.15.2/URI.min.js"></script>

我有链接并有两个字段,我试图动态设置值,如下所示,

// Get our <a> element
        link = document.getElementById('copyToNewWeek');

        // Use URI.js to work with the URI
        // http://medialize.github.io/URI.js/
        uri = URI(link.href);
        // Get the query string as an object
        qs = uri.query(true);

        // Change our value
        qs.selectedEventsForWeek = sessionIds.toString();
        qs.weekSelected = sessionDates[0];


       uri.query(qs);

       // Set our new HREF on the <a> element
       link.href = uri.toString();

但该值未设置为href

有人可以帮我吗?

0 个答案:

没有答案