Refresh parent window with querystring or replace it?

D

Debbie Davis

Hi there, I'm not very good at javascript but I'm using the following
to close a child window and refresh a parent window after updating a
database. It's within an ASP page.

CODE
<SCRIPT>
function CloseWindow() {
if (window.opener && !window.opener.closed) {
window.opener.document.location.reload();
window.close();
}
}
</SCRIPT>

When my parent window reloads, is there any way to include a
querystring, or replace the parent with another URL? It needs to
reload, but it needs to jump to a particular anchor on the page. I do
not want to use session variables. Any way to modify the above code
to accomplish this? Thanks.
 
R

Randy Webb

Debbie said:
Hi there, I'm not very good at javascript but I'm using the following
to close a child window and refresh a parent window after updating a
database. It's within an ASP page.

CODE
<SCRIPT>
function CloseWindow() {
if (window.opener && !window.opener.closed) {
window.opener.document.location.reload();
window.close();
}
}
</SCRIPT>

When my parent window reloads, is there any way to include a
querystring, or replace the parent with another URL? It needs to
reload, but it needs to jump to a particular anchor on the page. I do
not want to use session variables. Any way to modify the above code
to accomplish this? Thanks.

window.opener.location.href=window.opener.location.href + "#anchorName";

instead of reload(). Might be better to use
window.opener.location.replace() instead, so that the history trail
doesn't get too cluttered.


edit the anchorName as you need.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top