<body onload="..."/>. It does what I want there. (See https://github.com/cwestin/bobt/blob/master/site/style/article.html , and the sibling file http://github.com/cwestin/bobt/blob/master/site/style/bobt.js).
(*) I want to add this onload behavior to my Drupal site.
I followed the instructions on how to create a Drupal 7 module from here: http://drupal.org/node/361112.
However, this seems to be aimed at PHP development of block modules that generate content. All I have is the JS file, which will act on some div classes I put in my content's unfiltered HTML markup.
However, having created a module by following these incomplete instructions as best I can, it doesn't look like my JS is getting triggered. A View Source shows that my .js file is being included in the pages, but the transformation it does isn't happening (it did work in my dummy test page). It's possible I'm not translating into jQuery correctly; I've never used that before, and the syntax is clearly not just plain old JS.
Here's the module: https://github.com/cwestin/bobt/tree/master/site/style/sectiontoc . As you can see, in the spooky
function($) thingy, I add the required
attach() to try to add my behavior to
$(document).ready at the bottom. But as I said, it's not getting triggered.
Could anyone please tell me what I'm missing, or what I'm doing wrong here? Thanks in advance for any help.