PopUp Windows

This example

 

You can create a PopUp Window using HTML and the TARGET attribute.

Horse Head Nebula in Orion

Click on this image for a DEMO of a PopUp Window using HTML
Close the PopUp Window with its close button in the upper right corner of the window



Here's the HTML:

<A HREF="horsehead_lg.jpg" TARGET="NEW"><img src="horsehead_sm.gif" border=0></A>

You have no control over the size and appearance of this PopUp window. It mimics the window that created it.

 

Using JavaScript it is possible to customize the PopUp window.

Horse Head Nebula in Orion

Click on this image for a DEMO of a PopUp Window using JavaScript


Here's the JavaScript code:

<A HREF="javascript:void(0)" onClick="window.open('horsehead_lg.jpg', 'MyPopUp',  'width=432,height=270,toolbar=0,scrollbars=0,screenX=200,screenY=200,left=200,top=200')"><img src="horsehead_sm.gif" border=0> </A>

Here's a description of the JavaScript code that created this window.


 

You might want to add a close button to the JavaScript popup window. Here's an example.

Horse Head Nebula in Orion

Click on this image for a DEMO of a PopUp Window using JavaScript


Here's the JavaScript code:

<A HREF="javascript:void(0)" onClick="popup('horsehead_lg.jpg',  'width=432,height=325,toolbar=0,scrollbars=0,screenX=200,screenY=200,left=200,top=200')"><img src="horsehead_sm.gif" border=0> </A>

And this JavaScript code goes in the <HEAD> section of your document.

<SCRIPT LANGUAGE="JavaScript">
function popup(FILE, FEATURES) {
CONTENT = "<HTML><HEAD><TITLE>Horse Head</TITLE></HEAD>" + "<BODY><CENTER><FORM><INPUT TYPE='BUTTON' VALUE='Close'" + "onClick='window.close()'></FORM><P><IMG SRC='" + FILE + "' BORDER=0>" + "</CENTER>"+ "</BODY></HTML>";
pop = window.open("","",FEATURES);
pop.document.open();
pop.focus();
pop.document.write(CONTENT);
pop.document.close();
}
</SCRIPT>

 

That's it for PopUp windows. Now you can try out the online examples using PopUp windows.