Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
the following is my code which is in my index.aspx ..in the last line i gave as window.open...so,it is opening to a new window called Home.aspx and still the index.aspx is shown but index.aspx has to disappear when i move to Home.aspx..how to do.anyone help me know?..


JavaScript
<script type="text/javascript" > 
function pageopen()
{
var Hid = document.getElementById('HiddenFieldCity');
var HidA = document.getElementById('HiddenFieldArea');
var HidC = document.getElementById('HiddenFieldComm');
var HidD = document.getElementById('txtDate');
if (document.getElementById('ddlone').value=="Select Here")
{
alert("Please Select City");
return false;
}
window.open('Home.aspx?hid=' + Hid.value + '& HidA=' + HidA.value + '& HidC=' + HidC.value + '& HidD=' + HidD.value + '',"Welcome","titlebar=0,fullscreen=0,addressbar=0,left=0,top=0,maximized=yes,width=1024,height=700,scrollbars=no,resizable=yes") 
}
Posted
Updated 11-Jun-13 7:03am
v2
Comments
ZurdoDev 11-Jun-13 13:02pm    
Use document.location to change urls instead of open a new window. Is that what you are asking?
Sergey Alexandrovich Kryukov 11-Jun-13 13:06pm    
I would say, this is the complete answer. Will you post it as a solution?
—SA
deepa ashwi 11-Jun-13 13:33pm    
i m sorry..

<script type="text/javascript" >
function pageopen()
{
var Hid = document.getElementById('HiddenFieldCity');
var HidA = document.getElementById('HiddenFieldArea');
var HidC = document.getElementById('HiddenFieldComm');
var HidD = document.getElementById('txtDate');
if (document.getElementById('ddlone').value=="Select Here")
{
alert("Please Select City");
return false;
}
window.open('Home.aspx?hid=' + Hid.value + '& HidA=' + HidA.value + '& HidC=' + HidC.value + '& HidD=' + HidD.value + '',"Welcome","titlebar=0,fullscreen=0,addressbar=0,left=0,top=0,maximized=yes,width=1024,height=700,scrollbars=no,resizable=yes")
}



<asp:Button ID="btnGo" runat="server" Width="30" Text="Go" BackColor="CornflowerBlue"
BorderStyle="None" Font-Bold="True" ForeColor="White" OnClick="btnGo_Click" OnClientClick ="pageopen()" />
ZurdoDev 11-Jun-13 13:44pm    
Instead of using window.open use window.location = url to have the url open in the same window.
R. Giskard Reventlov 11-Jun-13 13:10pm    
Ryan's answer is all you need. If he doesn't post as a solution suggest you find another of his posts and up-vote him. Also not sure why you got a 1 vote for the question: certainly not the worst question I've seen posed here.

1 solution

Hi deepa ashwi,

Try this property (window.location.href).

window.location.href is not a method, it's a property that will tell you the current URL location of the browser. Setting the property to something different will redirect the page.

Also, window.location is read/write on all compliant browsers.

But, document.location is read-only in Internet Explorer (at least), but read/write in Gecko-based browsers (Firefox, SeaMonkey).

Thank you,
RelicV
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900