• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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
 
reply
    Bookmark Topic Watch Topic
  • New Topic