![]() |
Max characters that can be passed threw a Javascript function?
Is there a maximum amount of characters that can be passed threw a javascript function paramater?
ex: display(var1, var2) say var1 is 2 characters, var2 is 323432432 characters? theoritly speaking. |
That question really threw me. Until I realized you meant "through".
Anyway, I think you asked the wrong question. Reason: When you pass a string as an argument to a function, you are really only passing a *REFERENCE* to the string. And a *REFERENCE* will surely be represented as a memory pointer of some kind, which means it will likely be a 4-byte or 8-byte pointer (or possible integer, as an index into heap space, but I tend to doubt that implentation would be used). So the real question you are asking: What is the maximum length of a *STRING* in JavaScript? The answer is surely both browser dependent and computer dependent. Computer dependent because of course a string can't be longer than available memory on a given computer. Browser dependent because it depends on how strings are implemented in a given browser. Likely the theoretical maximum in most JavaScript implementations is 4 gigabytes or 2 gigacharacters, depending on implementation. Remember that all JavaScript strings are Unicode strings, so that normally means 2 bytes per character. (At least one source--at Google--says, though, that the maximum is about 512MB--or 256 megacharacters--for Chrome.) But that's all kind of moot: The real limit will almost surely depend on how much space the operating system has allocated for the current browser. After all, the browser has to share memory space with all the other programs executing in your computer. Can the sum of the memory sizes exceed the amount of RAM in your computer? Sure. Heard of "virtual memory", haven't you? But in general the OS will want to try to make sure that all *active* applications are running in real memory. In practice, if you can manage to make a string too large for a given browser, then your code isn't going to run very well, no matter what. So why are you trying to do this? |
My html: I am using smarty templating:
PHP Code:
Code:
function AddTrigger(path, stat, item, quest, npc, image, sound, zone) { |
That newdiv.innerHTML is a really bad way to create the contents of that div.
Ugly to use innerHTML with that much crap. |
What would be a better way to approach this?
|
Quote:
|
Quote:
|
| All times are GMT +1. The time now is 06:33 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.