// JavaScript functions to replace "confirm" with an arbitrary
// web page
//
// usage: <A HREF="http://site.com/page.htm" onClick="promptem(this)">
// display message box with the preformatted message included.
// promptem(this, 'height', 'width')
// specify a height and width after the first argument optionally
// you can change these defaults
var title = "Confirmation";
var h = 275; // default height
var w = 400; // default width
// you can change the "false"s to "true"s and vice-versa if need be.
function setParams(){
var p = "";
p += "toolbar=false";
p += ",location=false";
p += ",directories=false";
p += ",status=false";
p += ",menubar=false";
p += ",scrollbars=false";
p += ",resizable=false";
p += ",copyhistory=false";
return(p);
}
/******************************************************************************/
// don't screw with stuff after this line
/******************************************************************************/
function promptem(){
window.name = "lenny";
var params = setParams();
if(arguments.length > 1){
h = arguments[1];
w = arguments[2];
}
params += ",height=" + h + ",width=" + w;
out = window.open('', 'out', params);
out.document.close();
writeWindow(out, arguments[0]);
out.focus();
return(false);
}
// generates the frameset
function writeWindow(win, link){
win.document.open();
win.document.write("<HTML><HEAD><TITLE>");
win.document.write(title);
with(win.document){
writeln("</TITLE></HEAD>");
writeln("<BODY onLoad=\"document.forms[0].elements['ok'].focus()\">");
writeln("<TABLE HEIGHT='100%'><TR><TD VALIGN='CENTER'>");
writeln("<P>NOTICE: You are currently exiting the Office of the");
writeln("Seceratary of Defense (Health affairs) web site, and");
write("entering an external site (");
}
win.document.write(link.hostname);
with(win.document){
writeln("). We are happy to provide a link to this site");
writeln("for your convenience</P>");
writeln("<P>Please note that the Department of Defence does not");
writeln("review the contents of this site and cannot guarantee its");
writeln("accuracy. The appearance of this link does not");
writeln("constitute endorsement of this web site by the Department");
writeln("of Defense nor the information, services or products");
writeln("contained therin.</P>");
writeln("");
writeln("<FORM><P ALIGN='CENTER'><CENTER>");
writeln("<INPUT TYPE='BUTTON' NAME='ok' VALUE='OK' ");
}
win.document.write("onClick='opener.location.assign(\"");
win.document.write(link.href)
win.document.writeln("\");self.window.close()'>");
win.document.writeln("<INPUT TYPE='BUTTON' NAME='no' VALUE='CANCEL' ");
win.document.writeln("onClick='self.window.close()'>");
win.document.writeln("</CENTER></P></FORM></TD></TR></TABLE></BODY></HTML>");
win.document.close();
} |