Forum Moderators: open
I use a single line of code to reload/refresh my ASP page on one of the event for instance Cancel.
document.location.replace(page name)
The problem here is that the page is not reloaded/refreshed in MAC whereas it works as required in Windows.
Is there anything to do with the OS or I need to change the code itself to make it independent of the OS?
Your inputs will be highly appreciated.
Thank you.
~Bhavin
<select name="worldwide" onchange="[b]location.href=[/b][i]the new page[/i]"> I'm stumped. It should be working. Perhaps there is other javascript on the page conflicting?
document.location.replace("");
This line of code is within If condition. The If condition basically checks if user has made any changes to the current page. If yes, then a message if displayed with Ok & Cancel button.
On clicking Ok button, document.location.replace gets executed, which in turn redirects to the page within the replace method. On clicking Cancel button nothing happens.
Am kinda stuck with this. Anyways thanks for your help.
<html>
<head>
<script>
function checkchanges() {
if(document.getElementById("check").checked){
document.location.replace("http://www.webmasterworld.com/");
}
}
</script>
</head>
<body>
<input type="checkbox" value="1" name="check" id="check" />
<button onclick="checkchanges()">submit</button>
</body>
</html>
And also works with this syntax for the redirect line:
location.href="http://www.webmasterworld.com/"; So, it's not that part of your code that is breaking. :)
How are you showing the user a dialog box? That bit of code may provide insight into the error.
The existing code is written in this fashion
document.location.replace(abcd.asp)
where abcd.asp can be the same page or another page.
I assume that the way this ASP page is referenced is incorrect and that is the reason why is does not refresh or re-direct to the page mentioned in the replace method.
Please correct me if am wrong. And also let me know any alternative to this.
Thank you.