• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Opening a webpage in same window using javascript without anchor tag

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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>







 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
should open it in the same window, make sure you are not cached.

Eric
 
The first person to drink cow's milk. That started off as a dare from this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic