2

Possible Duplicate:
How to make a page redirect using Javascript?

i have an HTML pages i want to use to redirect from one page to another like response.redirect in ASP.Net. i think i must use JavaScript.

Community
  • 1
  • 1
Moutasim Momani
  • 149
  • 2
  • 3
  • 7

4 Answers4

6
<input type="button" onclick="document.location.href = 'http://google.com'" />

or without JS

<form action="/contact.html">
    <input type="submit">
</form>
adeneo
  • 312,895
  • 29
  • 395
  • 388
3

In JavaScript you can do:

window.location="http://someplace.com";

or on HTML button do this:

<input type="button" onclick="document.location='http://someplace.com'" />
Gurpreet Singh
  • 20,907
  • 5
  • 44
  • 60
1
onclick="document.location.href = 'http://google.com'"

OR

onclick="window.location = 'http://google.com'"

Should work fine if you add it into your tag, replacing google with your desired address of course.

Mohideen bin Mohammed
  • 18,813
  • 10
  • 112
  • 118
Luke
  • 4,908
  • 1
  • 37
  • 59
0

Or you could use a link styled as a button. If the only thing that button does is redirects to other page, then you should use a link, it would be semantically better.

valentinas
  • 4,277
  • 1
  • 20
  • 27