If you have not done so already, please finish and hand in the LaTeX exercises:
Although Java is supposed to be easier to use than C++, it is a
full-fledged programming language. If you wish to make a web
page "interactive" there are several reasons to
consider using the more limited scripting language
"JavaScript". First, you reduce the time
and effort that it takes to learn enough to be able to use the
language. Secondly, if you use Java, either you must have
access to the Common Gateway Interface (CGI) of your server (for
example, clam) or the system on which the browser
is working must have Java enabled. Commonly, Java is not
enabled on corporate and academic servers (for security), and
only a few people have access to the CGI on most servers.
To get some idea of what can be done with JavaScript, you can look at the top of this page for a very simple 5 function calculator, or for a more ambitious creation, see a scientific calculator written in JavaScript by Rolf Howarth. I think that this scientific calculator is impressive.
Alistair Fraser's Web Page at Penn State University demonstrates an event handler: if you move the cursor onto his photograph, one eye will seem to wink. You can get a good idea of how he does this by viewing the header of his source code.
There is a simple JavaScript tutorial by Stefan Koch called Voodoo's Introduction to JavaScript at University of Mannheim, Germany. This is based on his book, published in German, 'JavaScript - Einführung, Programmierung und Referenz'. However, the tutorial is in English.
Here are some other sites suggested in Netscape JavaScript 1.2 Book, Second Edition,
In case your web browser fails to display the JavaScript, here it is:
<SCRIPT LANGUAGE="JAVASCRIPT">
<!--
document.write("This document last modified on: ")
document.write(document.lastModified)
//-->
</SCRIPT>
Let me know via email when you have the JavaScript added to your page.
You can do this by modifying the head of your document so that it looks
something like this (supposing that you have an HTML file called
window.html that you want displayed in the window;
if you leave out window.html, so that there is an
empty pair of quotation marks, the window will be empty):
<head>
<TITLE>A Little JavaScript</TITLE>
</head>
<SCRIPT LANGUAGE="JAVASCRIPT">
<!--
function WinOpen() {
window.open("window.html", "freds_window","toolbar=yes");
}
//-->
</SCRIPT>
Later on in your document you can open a window in response to an
action by the person viewing your document. For example, you could
have somewhere in the body of your document the following:
<form> <input type="button" name="WindowButton" value="Open Secondary Window" onclick="WinOpen()"> </form>
type="button" . Up to this point, the code looks
like ordinary HTML: we have a container, the INPUT ELEMENT container, with
attributes name= and value=.
However, the ATTRIBUTE
onclick= is not HTML, but rather JavaScript. It is
an example of an event handler. You can put a message in
the file window.html using HTML, of course. For example,
you could display the message, "Close this window to return to the main
browser window."
If you have done all the above activities, and there is still time left, here are some other activities you can do.
If you have not handed in information on the topics listed below, please search the topics as homework, and print out some information on each of the topics. The URLs should be given, of course.