Example of a simple function in a document
Here you see a function, named 'displayAA'. The function is situated in top of the file. That function can display the values of two simple properties if you use them - somewhere - in the html-file between script-tags.
<HTML>
<HEAD>
<TITLE>......</TITLE>
</HEAD>
<SCRIPT>
function displayAA ()
{
window.document.open()
window.document.writeln("Location: ",window.location + "<BR>")
window.document.writeln("Last modified: ",window.document.lastModified + "<BR>")
window.document.close()
}
</SCRIPT>
<BODY>
xxx
xxx
xxx
etc.
xxx
xxx
<SCRIPT>
displayAA ()
</SCRIPT>
xxx
xxx
etc.
xxx
xxx
</BODY>
</HTML>
Result:
Comment:
You see HTML-tags, ascii-strings, the '+'-sign to connect two ascii-strings. The function has no parameters.
Remarks:
Remark: 'window.document.lastModified' only works good in Internet Explorer, not in all Netscape versions.
Enschede, 4 nov. 1999; updated: jan, 28, 2003