by Thomas 'Po » Fri, 23 Jan 2004 19:35:27
Sallade wrote:
First of all, no version of Netscape 4.7x knows XHTML, so do not
use it if you want to support this UA. And there are other good
reasons for not using XHTML nowadays.[1]
Secondly, there are differences between Netscape 4.7x versions.[2]
There are no classes in JavaScript 1.x and its related languages,
you have created a prototype (object) by a constructor (function).[3]
Note that every method is a property of type "function" (IE shows
"object" [IMHO falsely] as every function is a Function object.)
If you already have a server-side application, use it instead for
the parts that do not work without the server. See below.
For valid (X)HTML, the DOCTYPE and character set declarations are
required.[4]
For valid HTML 4(.01), the "type" attribute is required.[4]
Not that I think NS4 cares much of it, but other UAs will.
You better end all of your statements with a semicolon, do
not rely on auto-completion.
You better allow the properties to have a default value, otherwise
they are assigned "undefined" if an argument is left out:
this.foobar = argument_identifier || default_value;
Are you accessing https: from https:? If yes, you have just
run into the Same Origin Policy[5].
If you are writing URIs dynamically, you should escape "&" with
"&" (one time ;-)), for you will create invalid (X)HTML
otherwise.[4]
If an inner function is a property anyway, you should assign it
directly:
this.foobar =
function foobar()
{
// ...
};
Note that a "function" statement within a statement (incl. assignment)
requires JavaScript >= 1.2, according to the Core JavaScript 1.5
Reference.[6] (The same Reference states that Netscape 4.x supports
JavaScript 1.2, though it is, alas, not reliable; I found out that
Netscape 4.79 supports anonymous functions [i.e. created using the
"function" operator of JavaScript 1.5/ECMAScript 3] although the
Reference states that Netscape 4.7x supports JavaScript 1.3 only.
So you need to test for it.)
And you better give your methods speaking identifiers from which
you can make a good guess what they actually do.
(Note that document.write(...) overwrites a loaded document, so
do not use it after the document has be loaded, i.e. do not call
methods that call it then. You actually do not do so but remember
this if you are tempted to do so later. There are other DOM
methods you can use instead, even in NN4.)
Do not save numeric data as (character) strings. Save it as number
and if a unit (e.g. a currency) is attached to it, save the unit
separately (e.g. through a prototype constructor) or do not save it
at all, depending on your needs.
This is invalid (X)HTML. The (X)HTML "form"
element does not have a "runat" attribute (in
neither DTD).
The javascript: URI scheme is proprietary and used out of
purpose (generating content through Javascript expressions)
here. Use intrinsic event-handler attributes and avoid
"javascript:" if you can, see the FAQ.
Furthermore, including "script" elements in "a" elements
can get you into trouble. You better write the whole
"a" element dynamically, including its content.
I read this as an XHTML "br" element specified through
SHORTTAG syntax,
but the "language" attribute is deprecated in both
HTML 4.01 and XHTML 1.0. There is not one in XHTML
1.1.
So you are generating all of the docum