aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Opening a webpage in same window using javascript without anchor tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Opening a webpage in same window using javascript without anchor tag" Watch "Opening a webpage in same window using javascript without anchor tag" New topic
Author

Opening a webpage in same window using javascript without anchor tag

Sun Il Kumar
Greenhorn

Joined: Mar 02, 2011
Posts: 5
i try many things but they all are opening the webpage in other window.Can any one give ans "How to open a webpage(webForm1.aspx) in same window "




<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>

</head>

<body>
<form id="form1" runat="server">
<div> <asp:Button ID="Button1" runat="server" Text="Button 1" OnClientClick="Func()"/>
<input type="text" id="text" />
</div>
</form>
</body>
</html>



<script type="text/javascript" language="javascript">
function Func() {
var Store = document.getElementById('text');
var abc= Store.value;
if (abc == "HI") {
//window.open("WebForm1.aspx");
//document.location = "WebForm1.aspx";
// top.frames[0].location = "WebForm1.aspx";
//self.location = "WebForm1.aspx";
//parent.location = "WebForm1.aspx";
window.location.href = "Default2.aspx";
}
else {
alert('Cancelled');
}
}
</script>







Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
should open it in the same window, make sure you are not cached.

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Opening a webpage in same window using javascript without anchor tag