Opening a small (or child ) window from a main ( or parent ) window

We can open a small window known as child window by clicking a button or a link or a image of a main window. We can control the width, height and location ( alignment from top left corner of the screen ) of the small window from the main window. Here we can control the status bar, tool bar and resize the child window from the main window. By changing the value of status to 1 form 0 (status=1;) we can display the status bar for the child window. Same way by making the toolbar=1; we can display the tool bars for the small window. We can change the value of left to position the window horizontally. If we make the value of left to 0 like left=0; to align the window to left edge of the screen. Same way by making the top=0; we can place the window at the top of the screen. Don't forget to refresh the parent window every time you change the parameters. Here is the code at the parent window to display the link. Click the demo link to see how the window opens.

Click here to open the child window

Here is the code of the above link

<a href="javascript:void(0);"
NAME="My Window Name" title=" My title here "
onClick=window.open("window-child.html","Ratting","width=550,height=170,0,status=0,");>Click here to open the child window</a>

Here is a button to open the same window



Here is the code of this button

<input type=button onClick=window.open("window-child.html","Ratting","width=550,
height=170,left=150,top=200,toolbar=0,status=0,"); value="Open Window">

Take care of line break in above code.( Remove )

Scrollbar on child window

We can add scroll bar to child window by adding scrollbars=1 while opening the window. Here is the modified code.

<a href="javascript:void(0);"
NAME="My Window Name" title=" My title here "
onClick=window.open("window-child.html","Ratting","width=550,height=170,0,status=0,scrollbars=1");>Click here to open the child window</a>

Click here to open the child window

Number of User Comments : 7


Google+

Thangavel

20-08-2012

thank you:friend:)how to pass the value from child window to parent window
Peter

25-08-2012

Thank you! This helped me so much
bhushan wagh

28-05-2014

Thanks a lot,it's really cool exam.
Wenceslau

22-07-2014

Thank you. It helped me a lot.
Jessilyn

26-09-2014

You just saved me hours of time.
Thomas

06-04-2015

How to open sub window in the same page without new browser tag

Post Comment This is for short comments only. Use the forum for more discussions.







OPINION POLL

What is the most important factor of a web site
HTML . MySQL. PHP. JavaScript. ASP. Photoshop. Articles. FORUM Contact us

©2000-2015 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer