ShinyManu
ShinyManu

Reputation: 69

How to redirect a page using Javascript?

My Scenario,

We Have wriitten a javascript in click on image to open the curtain raiser.When its done it should redirect to a page in website.How do we achive this? Please Help

Upvotes: 2

Views: 912

Answers (2)

Ghostman
Ghostman

Reputation: 6114

 <img src="images/myimage.jpg" name="btnHello" onclick="Test();"/>

function Test() {
window.location.href = "page to be redirected url";
 }

Something like this?

Upvotes: 0

James Hill
James Hill

Reputation: 61842

If you'd like a more detailed answer, you should provide your existing JavaScript. Otherwise, this is the best that I can do.

To redirect a page, change the window.location.href property:

window.location.href = "http://yourpage.com";

Upvotes: 5

Related Questions