JavaScript Tip of the Week for May 20, 1996: All about Windows (No, not the OS) | Source Code
for May 20, 1996: Source Code: All about Windows (No, not the OS)
Jump to source of:
- How do I make windows?
- Using remotes to help users navigate around a site
- Using forms and windows together
Source code for How do I make windows?:
/* This code is Copyright (c) 1996 Nick Heinle and Athenia Associates,
* all rights reserved. In order to receive the right to license this
* code for use on your site the original code must be copied from the
* Web site webreference.com/javascript/. License is granted to user to
* reuse this code on their own Web site if and only if this entire copyright
* notice is included. Code written by Nick Heinle of webreference.com.
*/
msgWindow=window.open("test.html",
"NameofWindow",
"toolbar=no,
width=350,
height=400,
directories=no,
status=no,
scrollbars=yes,
resize=no,
menubar=no")
Source code for Using remotes to help users navigate around a site:
/* This code is Copyright (c) 1996 Nick Heinle and Athenia Associates,
* all rights reserved. In order to receive the right to license this
* code for use on your site the original code must be copied from the
* Web site webreference.com/javascript/. License is granted to user to
* reuse this code on their own Web site if and only if this entire copyright
* notice is included. Code written by Nick Heinle of webreference.com.
*/
var remote = null;
function remoteStart() {
remote = window.open('', 'TheRemote', 'width=250,height=425,resizable=1');
if (remote != null) {
if (remote.opener == null) {
remote.opener = self;
}
remote.location.href = 'http://www.yourdomain/remote.html';
}
}
Then put this in remote:
function fetch(url) {
opener.location = url;
}
Use this for links:
<A HREF = "JavaScript:fetch('URL_here')">Link</A>
To create status bar messages through a remote:
function message(txt){
opener.status = txt;
setTimeout("remove()",2500);
}
function remove(){
opener.status="";
}
Then add this in the HREF tag:
onMouseOver = "message('Message Here');return true;">
Source code for Using forms and windows together:
function CreateWindow()
{
msgWindow=window.open("test.html","displayWindow","toolbar=no,width=350,height=400,directories=no,status=no,scrollbars=yes,resize=no,menubar=no")
}
function create(form){
if (confirm("Are you sure?"))
{
text = ("<HEAD><TITLE>Mark Anthony's Address from 'Julius Caesar'</TITLE></HEAD>");
text = (text +"<BODY BGCOLOR = '#FFFFFF'><CENTER><B><FONT SIZE = 4>Mark Anthony's Address from<BR> 'Julius Caesar'</FONT></B></CENTER><BR><BR>");
text = (text +"Friends, Romans, " +form.input1.value+ " lend me your " +form.input2.value+ "; ");
text = (text +"I come to " +form.input3.value+ " Caesar, not to praise him. ");
text = (text +"The evil that men do lives after them, the good is oft interred with their " +form.input4.value+ "; ");
text = (text +"so let it be with " +form.input5.value+ ". " );
text = (text +"The noble Brutus hath told you Caesar was " +form.input6.value+ "; if it were so, it was a grievous fault. ");
text = (text +"If you have " +form.input7.value+ ", prepare to shed them now. ");
text = (text +"You all do know this " +form.input8.value+ ". ");
text = (text +"I remember the first time Caesar put it on. ");
text = (text +"Through this well-beloved Brutus stabbed; for Brutus, as you know, was Caesar's " +form.input9.value+ ": ");
text = (text +"this was the unkindest " +form.input10.value+ " of all. ");
text = (text +"Here is the " +form.input11.value+ ", under Caesar's seal. To every Roman " +form.input12.value+ " he gives, ");
text = (text +"to every several man, seventy five " +form.input13.value+ ". ");
text = (text +"Here was a/an " +form.input14.value+ "! When comes another?");
msgWindow=window.open("","displayWindow","toolbar=no,width=375,height=480,directories=no,status=no,scrollbars=yes,resize=no,menubar=no")
msgWindow.document.write(text)
msgWindow.document.close()
}
}


