[sf-perl] OffTopic: Any JavaScript programmers here?

Vicki Brown vlb at cfcl.com
Fri Jul 4 22:02:08 PDT 2008


At 20:31 -0700 07/04/2008, Kevin Frost wrote:
> Noooo! Don't poison the novices with innerHTML!  That's like telling
> people not to 'use strict' in Perl.

Being a Perl programmer, I can totally understand your trepidation.
However... speaking as a frustrated JS noobie... the innerHTML worked.
:-)(-:

Less frightening variations would be gratefully accepted.

Also, if anyone has any hints about how to handle more than one sortable
list on a page, I'd be grateful. :)  The sort function is handed an ID to
the list to sort.

In Perl I'd use a hash
   origList[$id] = #save the list data;

and then I'd just go looking for origList[$id] when I was asked to revert
theList[$id]

Surprisingly, I don't see hashes (or 'associative arrays') in JavaScript.
Although something described as an 'associative array' is present, it
doesn't seem to be quite the same thing.

Current code is here:
   http://cfcl.com/twikipub/Learn/Tut/TWikiTutListSort/list_sort.js

Example page
   http://cfcl.com/twiki/bin/view/Learn/Tut/TWikiTutListSort

And many thanks for helping me in this educational exercise... if any of
you have a TWiki you're running and have questions about how to do
something there, just ask!!!
-- 
- Vicki

     ZZZ
  zzZ                   San Francisco Bay Area, CA
 z  |\     _,,,---,,_   Books, Cats, Tech
zz /,`.-'`'    -.  ;-;;,_  http://cfcl.com/vlb
  |,4-  ) )-,_. ,\ ( `'-'  http://cfcl.com/vlb/weblog
 '---''(_/--'  `-'\_)      http://twitter.com/vlb


More information about the SanFrancisco-pm mailing list