Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9055843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T14:03:13+00:00 2026-06-16T14:03:13+00:00

From the main page I would like to open a child window and from

  • 0

From the main page I would like to open a child window and from the child window I would like to open a another window. how is it possible?
I have tried the below code and its not working.

<script type='text/javascript">
function click1(){
var win1=window.open();
win1.document.write("first window");
var windowHTML ='<input type="button" value="click"   onclick="click2()" />';
win1.document.write(windowHTML); 
}    

function click2(){
 var win2=window.open();
 win2.document.write("seccond window");
}

​

 <input type="button" value="click1" onclick="click1()" />​
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T14:03:14+00:00Added an answer on June 16, 2026 at 2:03 pm

    Two options:

    1. Use opener in the child

    Change

    var windowHTML ='<input type="button" value="click"   onclick="click2()" />';
    

    to

    var windowHTML ='<input type="button" value="click"   onclick="opener.click2()" />';
    // Change is here ---------------------------------------------^
    

    opener in the child window will be a reference to your main window, and since you’re using global functions, they can be called via that reference (assuming that there are no SOP issues).

    2. Put the code in the child

    Alternately, you can put the code you want to trigger in the child window by writing a script tag to it (either one that contains inline JavaScript, which is a bit dodgy, or one that references an external file, which would be better).


    FWIW, I’d recommend stepping back and asking whether you really need to use multiple windows rather than sticking to one window and doing “virtual” windows via divs and such.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like access the IFrame element available in the main page from the
Our SEO team would like to open up our main dynamic search results page
I have a main page from where I am making a call to load
I have a page (main.php) which loads content from an external PHP file (rpc.php).
The Idea I have a main PHP page that loads content in DIV's from
Possible Duplicate: Iframe Function Calling From Iframe to parent page javascript function I have
I would like to load a page with results from an AJAX call, which
I have a dialog window that I open from a record in a datagrid,
I have a Page in Silverlight which is Navigated from the MainPage.xaml, called OpenPage.xaml,
i'm trying to pass a string from main to another function. this string is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.