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.

4

4 回答 4

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

or without JS

<form action="/contact.html">
    <input type="submit">
</form>
于 2012-12-16T20:22:49.163 回答
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'" />
于 2012-12-16T20:22:39.080 回答
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.

于 2012-12-16T20:23:35.920 回答
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.

于 2012-12-16T20:23:21.210 回答