Window.Location = Undefined?

javascript Denmark
  • 13 years ago

    This code redirects me to Undefined each time! Why? And how to solve it?

            var WL=window.location;
            window.location=WL.replace("Shout", "Idle");

  • 13 years ago
    Mathy wrote:

    This code redirects me to Undefined each time! Why? And how to solve it?

            var WL=window.location;
            window.location=WL.replace("Shout", "Idle");



    try:-

    document.location.replace("Shout","Idle");

    never having used replace() I cant say if your using it correctly but I have always known the reference to be document.location and not window.location, you could try both...







Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Nine people can't make a baby in a month.” - Fred Brooks