- IE can give "object expected" error when you are calling Javascrupt function at load time -
and that function itself is located lower on the page. Netscape doesn't have this problem.
- "Error in line 1" usually means that file you are using in script src is missing.
- You can declare array withotu spercifying the size:
var x=new Array();
The x.length will be set to 2 - index of last assigned element.
for concatenation. Workaround: x = x - (-1) :)
- You can read the caption of OPTION element using the .text property.
- Calculating page load time (from DevEdge):
Start = new Date()
Stop = new Date()
Diff = Stop.getTime() - Start.getTime();
- IE can get confused and show strange messages when you
have some plain HTML inside <SCRIPT> tag.
- Code to close the window without confirmation:
- Checking whether form has a field:
- Useful string functions:
This creates array r, r... - works like PARSE VAR in REXX
- charAt - like sunstring, except returns single cher
- replace - useful func, but the syntax is somewhat cryptic.
s="a b c bbBB"
x=s.replace(/b/, "*"); - replace first occurence of b with *
x=s.replace(/b/g, "*"); - replace all occurences except uppercase ones
x=s.replace(/b/gi, "*"); - ignore case, replaces all 'b's and 'B's
Nore = if you enclose first /b/ in quotes, it will not work!!
Also, unless I am mistaken, this limits the usefulness of the function -
because there doesn't seem a way to build the first parm via variable.
Sure, you can say x=/b/, but that's not very useful. Try this:
x=/ + what + /;
... it doesn't work.
- substring - 2nd parameter is indexr, while in subst, second parm
- toLowerCase, toUpperCase - self-explanatory
- search, match - funcs for locating regex within a string.
- Everybody knows that you can break out of frame in HTML using "target=_top" in <a href>.
"location=" you will use "parent.location.href=".
- Use escape() function to convert spaces into %20 in a string.
IE and Opera wouldn't care either way, but Netscape may misbehave
the major cause of 'has no properties' error is specifying
something like FORM NAME=XX instead of FORM NAME="xx".