?
Solved

Creating child windows from links and setting focus to child

Posted on 2001-07-02
4
Medium Priority
?
188 Views
Last Modified: 2006-11-17
I have an asp page with a link on it. When the user clicks on it I need to open a child window and load another page in it, at the same time I need to change something on the current page where the link is there. I tried two methods, but both are not working the same way as I want. I tried to submit the form to itself in the onclick of the link and then create the child window in the submit procedure. It works but the problem is the focus will come back to the parent form, instead of the child form as I used submit. I tried an alternate thing, instead of posting the form to itself called the same form itself with a querystring in the href of the link and then used the window.open in the body of the page checking the query string value. It also works, but the problem is when I hit on the next button(which will load another page) on the parent and then hit on the browser's back button, the child window is again creating as the history still has the query string in it ? Is there any alternate mthod to achieve this ?
0
Comment
Question by:rsaji
[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
  • 2
4 Comments
 
LVL 9

Accepted Solution

by:
msdixon earned 150 total points
ID: 6246141
<a href="javascript:openNew()">click here</a>
<script>
function openNew()
{
  window.open('', 'windowName'); // window parameters would be the third parameter
  // haven't tested the following 2 lines
  document.forms[0].target = 'windowName';
  document.forms[0].submit();

  // change the current url
  window.location = 'newPage.asp';
}
</script>
0
 
LVL 8

Expert Comment

by:drittich
ID: 6246145
Is something like this what you are looking for?

<html>
<head>
<script language="javascript">
    function DoStuff() {
        alert('doing something here');
        window.open('http://www.google.com');
    }
</script>


</head>
<body>
<a href="javascript:DoStuff()">click me to do some stuff</a>
</body>
</html>


You can put what ever you want done in place of the alert command.
0
 
LVL 4

Expert Comment

by:epeele
ID: 6246163
<script language=javascript>

  function openChild(){
     var newWindow = window.open("some.asp","newWindow");
     
     lnkOpen.innerText = "Open Again";

     newWindow.focus();
 
  }
</script>


<a id=lnkOpen name=lnkOpen href="javascript:openChild();">Open Child</a>
0
 
LVL 4

Expert Comment

by:epeele
ID: 6246164
sorry, cross post
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

764 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