Click here to Skip to main content
16,017,261 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
on click event of Html input button , i need to redirect to another page , please tell me how to redirect in javascript
Posted

Hi,

Just set the URL of that page
JavaScript
document.window.location="[URL]";


Sorry my mistake

XML
<script language="javascript" type="text/javascript">
window.location.href="Url";
</script>
 
Share this answer
 
v2
Comments
kalaivanan from Bangalore, India 4-Jan-13 3:29am    
i written code document.window.location="Default.aspx";

but it giving this error

Microsoft JScript runtime error: Unable to set value of the property 'location': object is null or undefined
Suvabrata Roy 4-Jan-13 4:01am    
Sorry i have forgot to add href

:)
Hi,

You can use some thing like the following:

C#
// similar behavior as an HTTP redirect
window.location.replace("http://stackoverflow.com");

// similar behavior as clicking on a link
window.location.href = "http://stackoverflow.com";


Fore reference you can refer the following links too.
To redirect from one page to another page
Redirecting to another page in asp.net MVC using javascript/Jquery
How to make a button redirect to another page using jQuery or just Javascript
How can I make a redirect page in jQuery/JavaScript?

Thanks
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900