English 中文(简体)
重定向到其他窗口 JS
原标题:Redirect to other window JS

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

我想将目录更改为

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

我尝试了使用窗口. 位置 (“ games.htm ” ) ; 但它会重定向到目录 :

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

什么办法?

最佳回答

你可以尝试:

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

或:

window.location("/MyWeb/games.htm");
问题回答

使用

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

或仅此

window.location =  /MyWeb/games.htm ;

我通常用

window.location.href = ...

window.location.replace(...);

还看看这个""https://stackoverflow.com/ questions/1865837/whats-the-difference- between- window-place-and-window-place-replace",

你应该使用

window.location.href = "/myweb/games.htm"




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签