You are here: irt.org | About | Feedback | 215 [ previous next ]
Feedback on:
JavaScript FAQ Knowledge Base Q757
Sent by
Tom Van Vleck on June 01, 1999 at 18:23:43:
Length:
Too short
Comments:
"this does not always work" is kinda vague.
So far I have been able to get 'em to work,
but I use onLoad() to run my scripts, which
takes care of the is-it-loaded problem for me.
Here's a gotcha I just spent four days on:
suppose you have a Java method that returns
String, and in Javascript you say
var x = document.whatzis.foo(bar)
What's the type of x?
In MSIE, it's String.
In Netscape, it's NOT.. it has
a length() function but no length property.
You can document.write() it OK, and it is
convertible to a String.
The portable work-around: write
var x = new String(document.whatzis.foo(bar))
to ensure that you can refer to
x.length
etc.