This example
- It starts with an anchor tag <A HREF= ... > since the pop up window is created when the thumbnail image, horsehead_sm.gif, is clicked.
- The next item you see is "javascript:void(0)". This tells your browser to keep the window that it's already on and not to load a new one.
- onClick tells your browser to execute the JavaScript that appears inside its quotes when the thumbnail is clicked. The JavaScript code is: "window.open('horsehead_lg.jpg', 'MyPopUp', 'width=432,height=270,toolbar=0,scrollbars=0,screenX=200,screenY=200,left=200,top=200')"
- the syntax of the window.open() method is: window.open('URL', 'WindowName', 'Features')
- URL is the file to be loaded into the PopUp Window.
- WindowName is the TARGET name of the new window.
- Features describe the appearance of the window.
- toolbar determines whether a toolbar (includes the forward and back buttons) is displayed. Options are 1 (YES) or 0 (NO).
- status determines whether a status line appears at the bottom of PopUp window. Options are 1 or 0.
- scrollbars determines whether scrollbars appear on the PopUp window. Options are 1 or 0.
- resize determines whether the PopUp window can be resized. Options are 1 or 0.
- width sets the width in pixels of the PopUp window.
- height sets the height in pixels of the PopUp window.
- left and top are IE4-specific features. They specify the placement of the PopUp window in relation to the upper-left corner of the monitor.
- screenX and screenY are Nav4-specific features. They specify the placement of the PopUp window in relation to the upper-left corner of the monitor. It's OK to place both the IE4 and Nav4 code in the same string without creating a JavaScript error.
function popup(FILE, FEATURES) {</SCRIPT>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();