I am trying to teach myself a little JavaScript. I am able to write simple
JavaScript like the following:
<!-- NavigatorProperties.html -->
<html>
<body>
<h3>Properties of "Navigator"</h3>
<hr>
<script language="JavaScript">
for (propertyName in navigator) {
document.write(propertyName + "<br>");
}
</script>
</body>
</html>
However, it occurred to me that after duplicating this code several times
for different objects, I could write something that would involve selecting
an object and then getting its report. I made it throu the following code and
am stuck at the comment.
<!-- SelectObjectProperties.html -->
<html>
<head>
<script type="text/javascript" language="javascript"><!--
function writeProperty(obj) { <br><h3>Properties of "obj"</h3><hr>
for (propertyName in obj) { document.write(propertyName + "<br>"); }
}
// -->
</script>
<noscript><p>A Javascript-enabled browser is recommended.</p></noscript>
</head>
<body><h3>Select an Object</h3>
<form name="objects" method="post"><select name="object">
<option value="Navigator">Navigator
<option value="Window">Window
<option value="History">History
<option value="Document" selected>Document
<option value="Location">Location
<option value="Document.Links">Document.Links
<option value="Document.Anchor">Document.Anchor
<option value="Document.Forms">Document.Forms
</select></form>
// -- It seems that something should go here to invoke the writeProperties
function. But I am not sure what should go here. //
</body>
--
Thank you in advance for your time.
Regards,