Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Free Nodelet Hack: Collapse/expand Nodelets individually (JS hashes)

by ikegami (Patriarch)
on Feb 05, 2007 at 12:52 UTC ( [id://598367]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Free Nodelet Hack: Collapse/expand Nodelets individually
in thread Free Nodelet freed

That could've been more 'elegant'... but it's a hack. If JavaScript had hashes...

But it does! JavaScript calls them Objects. (Kinda like how objects are usually implemented as hashes in Perl).

// Hash creation and initialization var hash = new Object; var hash = {}; var hash = { foo: "Foo!", bar: "Bar!" }; var hash = { "spaced out": "ok" }; // Setting hash.foo = "Foo!"; // Static key hash["bar"] = "Bar!"; // Dynamic key // Getting alert("hash.foo: " + hash["foo"]); // Dynamic key alert("hash.bar: " + hash.bar); // Static key // Iterating for (var key in hash) { var val = hash[key]; alert("hash." + key + ": " + val); }
  • Comment on Re: Free Nodelet Hack: Collapse/expand Nodelets individually (JS hashes)
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://598367]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.