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
Solved

Creating child windows from links and setting focus to child

Posted on 2001-07-02
4
185 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
  • 2
4 Comments
 
LVL 9

Accepted Solution

by:
msdixon earned 50 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
replace quotes with UTF-8 character 38 104
ASP SQL Syntax Duplicate Key 7 110
Hide Table in merge 3 29
Obtaining data on ASP 8 28
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

792 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