home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Practical Internet Web Designer 88
/
PIWD88.iso
/
mac
/
contents
/
dreamweaver
/
tutorial_files
/
Pages58-60
/
ASSETS
/
JSCRIPT
/
JS_POPUP.TXT
Wrap
Text File
|
2003-11-06
|
2KB
|
63 lines
<!--
// popup window variables
var windowWidth=400;
var windowHeight=270;
var windowPositionFromLeft = 250;
var windowPositionFromTop = 100;
var windowTitle = "CD Preview Window";
var windowCode = "width="+windowWidth+",height="+windowHeight;
// set autoClose to true to close pop-up window automatically if user leaves the launching page; else, false
var autoClose = true;
// test to check user's browser type (value will return true for Internet Explorer)
var checkBrowser = document.all?true:false
function openFramelessPopUpWindow(pageName) {
if (checkBrowser) {
// script for Internet Explorer - creates a frameless pop-up window
newPopUpWindow = window.open("","cdPopUpWindow","fullscreen,"+windowCode);
newPopUpWindow.blur();
window.focus();
newPopUpWindow.resizeTo(windowWidth,windowHeight);
newPopUpWindow.moveTo(windowPositionFromLeft,windowPositionFromTop);
// frameset code to generate scroll bars for pages larger than the frameless pop-up window page area
var framesetHTMLCode=""+
"<html>"+
"<head>"+
"<title>"+windowTitle+"</title>"+
"</head>"+
"<frameset rows='*,0' framespacing=0 border=0 frameborder=0>"+
"<frame name='top' src='"+pageName+"' scrolling=auto>"+
"<frame name='bottom' src='about:blank' scrolling='no'>"+
"</frameset>"+
"</html>";
// write frameset code dynamically to the frameless pop-up window
newPopUpWindow.document.open();
newPopUpWindow.document.write(framesetHTMLCode);
newPopUpWindow.document.close();
} else {
// Script for all other browsers - creates a standard pop-up window with title and auto scroll bars
newPopUpWindow = window.open(pageName,"cdPopUpWindow","scrollbars,"+windowCode);
newPopUpWindow.blur();
window.focus();
newPopUpWindow.resizeTo(windowWidth,windowHeight);
newPopUpWindow.moveTo(windowPositionFromLeft,windowPositionFromTop);
}
// if autoClose set to true the following code closes the pop-up window when the launching page is left
newPopUpWindow.focus();
if (autoClose) {
window.onunload = function() { newPopUpWindow.close();
}}
}
// -->