View Full Version : Limits on Javascript??

10-23-2006, 01:20 PM
is there a maximum limit on the size a javascript can be??

i have a large script (triple combo)
which is to be used as a main interface within a web site
the code is probably 4000+ lines of code long and has a file size of 1,200kb

is this too big
as i cannot get it to work beyond section 9 (there are 20 sections in total)

can someone please advise if there is a better way of doing it i am currently trying to use the script on http://www.javascriptkit.com/script/script2/triplecombo.shtml which i have split into a seperate javascript (.js file)

thanks for any help in advance:thumbsup:

10-23-2006, 03:04 PM
there is no limit to size, just have to remember the bigger, the longer it takes to load.

If you are doing a triple combo, you probably should be using a server side language with postback/Ajax to get the data to the client.


10-23-2006, 11:31 PM
If you want people to visit your web pages you have to keep the pages small enough to be usable. Approximately 50% of people will leave an 80k web page before it has finished loading so if you really want people to stay you need to keep the total initially loaded page size including all HTML, images, scripts etc below that and load the rest progressively afterwards via Ajax..

10-24-2006, 06:16 AM
About limits-

There is a limit to the length of an array in javascript-

if you try to write an array longer than 4,294,967,296 items you will throw an error.

var A=new Array(4294967295)
A.length returns 4294967295

var A=new Array(4294967296)
if you try to read A.length
a RangeError is thrown, with a message like 'invalid Array index'.