Solved

ASP & Java:  Need to close child, reload parent and set focus half way down page

Posted on 2004-08-02
20
275 Views
Last Modified: 2008-03-17
This is a hard question to ask but I'll give it a try... I've got a site going using classic ASP and some Javascript...

From main page, clicking on a link opens a child window.  

When a 'close' button is clicked in the child (submit button) the child window closes and refreshes the parent window.  To do that I use this code:

      window.opener.location = window.opener.location;
      self.close();

 This is good and was all I needed, but now I not only need the parent window to refresh, but I need 'focus' to be set on that parent window somewhere about 1/2 way down the page.  

Ideas???????
0
Comment
Question by:Tom F
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 8
20 Comments
 
LVL 2

Expert Comment

by:Michael_Cicogna
ID: 11693461
Hi

I don't see a big problem.

I think it should work if you do something like this in your popup window:

window.opener.location.reload();
window.opener.document.getElementById("field").focus();
self.close();

Michael
0
 
LVL 1

Author Comment

by:Tom F
ID: 11693790
I forgot to mention that when it comes to Javascripting, I'm a complete fool.

So the above code would go in the child (popup) window and when it closes should refresh the parent a set focus where exactly?
0
 
LVL 2

Expert Comment

by:Michael_Cicogna
ID: 11693957
yes - i think it should work
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 2

Expert Comment

by:Michael_Cicogna
ID: 11693963
oh - sorry - didn't read your question

it should set the focus to a input field with the id "field"
0
 
LVL 2

Expert Comment

by:Michael_Cicogna
ID: 11694004
if you don't want to set the focus, you could create an anchor with an id at the position you want to scroll to and use scrollIntoView();

Opener page:
     <A id="iViewMark"></A>
 
Popup page:
     window.opener.document.getElementById("iViewMark").scrollIntoView();
0
 
LVL 1

Author Comment

by:Tom F
ID: 11694379
Well, assuming that I'm not doing anything wrong neith of those two approaches seems to work.  They close the child, refresh the parent but fail toposition down the secrrenll
0
 
LVL 2

Expert Comment

by:Michael_Cicogna
ID: 11695365
Did you add the anchor on the opener page you want to scroll to?
i tried it out and it seems to work for me
0
 
LVL 1

Author Comment

by:Tom F
ID: 11697423
yes, I did... I can get it to work in other pages, just not these 2 ?
0
 
LVL 2

Expert Comment

by:Michael_Cicogna
ID: 11697495
could you post your code so i'll take a look at it?
0
 
LVL 1

Author Comment

by:Tom F
ID: 11697584
The main page is about 2000 lines of asp and html??? do you just want to see the popup, main, both?



0
 
LVL 2

Expert Comment

by:Michael_Cicogna
ID: 11697862
no, not necessary. Please refine your question since i am not so good in English.

What do you mean with:
    "yes, I did... I can get it to work in other pages, just not these 2 ?"
0
 
LVL 1

Author Comment

by:Tom F
ID: 11697896
I mean I made two very small and simple pages with the code you provided and it seemed to work well.  But when I take that same code and use it in my project it fails to work.
0
 
LVL 2

Expert Comment

by:Michael_Cicogna
ID: 11698008
Why does it fail. Which message does it give. Which results does it give?
0
 
LVL 1

Author Comment

by:Tom F
ID: 11698137
No message is given.

The Pop-Up closes.  

The Parent Refreshes but it does not show/scroll to the portion of the page that has the anchor.
0
 
LVL 2

Expert Comment

by:Michael_Cicogna
ID: 11698254
Hmmm - it could be possible that the page has not already finished loading. Is it possible that you add the code for Scrolling to the onLoad event of the Parent page?

<BODY onload="document.getElementById("field").focus();">

0
 
LVL 1

Author Comment

by:Tom F
ID: 11698346
The problem with that is I dont ALWAYS want that focus given when the page loads - only when that PopUp windows is CLOSED.
0
 
LVL 2

Expert Comment

by:Michael_Cicogna
ID: 11698495
you could add some kind of querystring parameter to the url that causes the page to scroll down. if doing so you have to use your old code

window.opener.location = window.opener.location + '?scrolldown=true';

0
 
LVL 1

Author Comment

by:Tom F
ID: 11891799
Nothing here (or anywhere else) was successful.  I had to totally abandon the way I was trying to accomplish this task.  I request a refund of points.  Thank you.
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 11925165
PAQed, with points refunded (250)

modulo
Community Support Moderator
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
The viewer will learn how to count occurrences of each item in an array.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question