0

我试过使用 HTML5 window.history.pushState 函数,但我不能让它工作。

这是功能:

    function changeUrl() {
        window.history.pushState(object, "Title", "?side=annoncer&sletid=1");
    }

这是应该调用它的链接:

   <a href="javascript:void(0);" onClick="changeUrl();">

我做错什么了?

4

2 回答 2

5

你不需要设置一个对象

function changeUrl() {
        window.history.pushState(null, "Title", "?side=annoncer&sletid=1");
    }

检查它,它会正常工作。

于 2012-08-07T14:11:25.507 回答
0

将其更改为:

         window.history.pushState(null, "Title", "?side=annoncer&sletid=1"); 
于 2012-08-07T14:15:01.610 回答