0

I'm having problem in redirecting at JS. Here's the situation: the current directory of the html code is : http://localhost:7927/MyWeb/Catch%20the%20bird%20game/GAME1.html

I want to change the directory to

'http://localhost:7927/MyWeb/games.htm'

I tried using window.location("games.htm"); but it will redirect to that directory:

http://localhost:7927/MyWeb/Catch%20the%20bird%20game/GAME1.html/games.htm

What's the solution? Thanks.

4

4 回答 4

1

你可以试试:

window.location("../games.htm");

或者:

window.location("/MyWeb/games.htm");
于 2012-05-28T06:52:34.833 回答
0

你应该使用

window.location.href = "/myweb/games.htm"
于 2012-05-28T06:51:58.130 回答
0

利用

window.location = 'http://localhost:7927/MyWeb/games.htm';

或者只是这个

window.location = '/MyWeb/games.htm';
于 2012-05-28T06:58:10.917 回答
0

我通常使用

window.location.href = ...

或者

window.location.replace(...);

另请查看此SO 帖子

于 2012-05-28T07:07:17.787 回答