object-literal

jquery using object literal over multiple files

I've seen object literal examples and they look really nice and sensible. What I want to know is if it's possible to use object literal over multiple files, because all the examples I've seen had only 1 file. Thanks. ...

Javascript data structure for fast lookup and ordered looping?

Hi, is there a data structure or a pattern in Javascript that can be used for both fast lookup (by key, as with associative arrays) and for ordered looping? Right, now I am using object literals to store my data but I just disovered that Chrome does not maintain the order when looping over the property names. Is there a common way to ...

Javascript Object Literals and jQuery

I've updated the script here to give a better example. For $header I've got an anonymous function now returning $("#header"). Although this works I'm sure its not efficient as it calls $header every time it's used - so its the same as just using $("#header") throughout the code. What I really want is to store $("header") in a variable....

Using variables and functions in an object literal

Hi, I am doing my head in trying to get the ckeip jquery plugin to parse the id of my textarea to my php file. The plugin is activated by the class name of my textarea: $('.ckeip_edit').ckeip({ And then data is passed to my php file with an object literal: data: { name1 : 'value1', name2 : 'value2' }, I need to use the ...

Javascript object literal: value initialization?

Hi, i was using object literal to create an object with methods. Here a simple example. var SizeManager = { width : 800, height : 600, ratio : this.width / this.height, resize : function (newWidth) { width = newWidth; height = newWidth / ratio; } } My issue is that SizeManager.ratio returns "NaN". ...