Web Teacher Software
web database
Javacript 
Tutorial
CGI tutorial
web 
database consulting
web database training
contact us about web 
database software
press
Hosted Database Solutions
webteacher home
Web Teacher Consulting

javascript tutorial graphic


Take this course LIVE in Southern California
Rob Young will be leading 'JavaScript for the Total Non-Programmer' at Irvine Valley College this September. The class is offered in 2 sections:

1. Tue (9/23) and Thu (9/25) 6p-9p
2. Saturday (9/25) 9a-4p

Click here to register

Type a message in the box,
it will become a link to close the new window.


You guessed it, here is the code
Look it over, then we'll break it on down

<HTML>
<HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!-- Beginning of JavaScript -

function MyWindow(message) {

//Define Date to display in local syntax
now = new Date();
LocalTime = now.toLocaleString();

//Define contents of page
contents=
'<body bgcolor="beige">'+
'<h2>Hello</h2>'+
'Click on the message below to close this window<br>'+
'<A HREF="javascript:window.close()" >'+
message +
'</A>'

//Create new Window
options = "toolbar=0,status=0,menubar=0,scrollbars=0," +
"resizable=0,width=300,height=200";
newwindow=window.open("","mywindow", options);
newwindow.document.writeln(LocalTime);
newwindow.document.write(contents);
newwindow.document.close();
}

// - End of JavaScript - -->
</SCRIPT>

</HEAD>
<BODY bgcolor="white" onLoad="this.form1.text1.focus()">

<TABLE BORDER=1 bgcolor="beige"><tr><td><B>Type a message in the box, <br>it will become a link to close the new window.</B>
<FORM NAME="form1">
<INPUT NAME="text1" TYPE=Text SIZE="50" MAXLENGTH="50"><br>
<INPUT TYPE=Button VALUE="Create my window" onClick="MyWindow(form.text1.value)">
</FORM></TABLE>

</BODY>
</HTML>

Learn Methods

Home | WebData - Web Database Software | Javascript | CGI | Consulting | Map Builder | Contact Us | The Press Room