The location.href Command

On the previous page, I used this command in the second form, in hopes to link to another webpage. It did not work to move the user to another page when the Submit button was clicked. I know the href stands for Hypertext Reference, which helps to create links to another page. I just don't understand why it didn't work on the previous page, so I'm going to try to figure it out now.

I know that scripts using location.host and location.hostname don't work from a hard drive and need to be online to work. So I thought that maybe that was the case with location.href too, but I put it on my Geocities website and it still does not work.

It was stressed to watch the single and double quotation mark configurations. The double quotes surround location through to the end of the command. The double quotation marks suggest to the browser that the command is over. The URL of the page, that the link will send the user to, and should be inside single quotes. My code is okay in that respect.

I found it difficult to find the answer to this online, although it was interesting that there are many others having the same problem. But I've reached the conclusion that PHP and ASP might have the solutions more than JavaScript. And I don't know PHP or ASP, so I'm going to drop this for now...

Back Table of Contents Next