• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Opening a webpage in same window using javascript without anchor tag

 
Sun Il Kumar
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
should open it in the same window, make sure you are not cached.

Eric
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic