Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: Hi All


Message #1 by Keith Bamberger <keith@p...> on 14 Oct 2002 09:44:33 +0200
Hi,

I believe that all objects (including String) have a native property
"length"...
For instance:

var myString = "12345678";
var myLen = myString.length;

myLen would be... 8

The length of a querystring (the one total length of an URL) I believe has
some limitation, not sure, but think around 4096 bytes...

Another thing to remember: today many operating systems uses unicode,
which actually uses 2 bytes per char - in "old days" one byte was equal
to one char! :-)

Cheers

Sten Hougaard
EDB Gruppen, Denmark



                                                                                                                   
                    Keith                                                                                          
                    Bamberger            To:     "JavaScript HowTo" <javascript_howto@p...>                
                    <keith@p...       cc:                                                                       
                    se>                  Subject:     [javascript_howto] Hi All                                    
                                                                                                                   
                    14-10-2002                                                                                     
                    09:44                                                                                          
                    Please respond                                                                                 
                    to "JavaScript                                                                                 
                    HowTo"                                                                                         
                                                                                                                   
                                                                                                                   




Does anyone know how to show the length of a string in bytes?

I have a string but I cant pass it through my browser, My suspision is that
it is too large to post, Anybody know how to display that value with
JavaScript? (Of course I can cut and paste it into notepad and see the size
of the file to get a rough idea, but that isnt fun ;))



---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20




  Return to Index