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
  • 1
  • 3
  • 6

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
  • 303,455
  • 27
  • 380
  • 377
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,179
  • 5
  • 42
  • 57
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
  • 16,635
  • 8
  • 97
  • 110
Luke
  • 4,650
  • 1
  • 36
  • 56
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,157
  • 19
  • 27