I want to have an image that rotates from one graphic to another. I found code to do so at http://www.dyn-web.com/javascript/rotate-img/rotate-rand.html. But some of the code goes into the head section of a regular html page and some goes into the body. Here's some of the code from their sample page:


// rotation speed, path to images, linked (boolean), mouse events (boolean), target window name var rotator1 = new dw_RandRotator(4000, "images/", true, true); var imgList = new Array("smile.gif", "grim.gif", "frown.gif", "bomb.gif"); // images array, width and height of images, transition filter (boolean) rotator1.setUpImage(imgList, 88, 88, true); rotator1.addActions( "http://www.dyn-web.com/javascript/rotate-img/rotate-rand.html", "http://www.dyn-web.com", "http://www.dyn-web.com/bus/purchase.html", "http://www.dyn-web.com/bus/terms.html" );

Only local images are allowed.

I would like to paste all this into the body of a story, but I think the head info needs to go somewhere else. I tried pasting the head portion into my theme file, but that didn't work — possibly because I didn't put it into the right part of my theme file.

Any suggestions?

Comments

Vahrokh’s picture

I only ever needed to use the

http://api.drupal.org/api/function/drupal_add_js/5

function, no need to touch the template or break anything.

I put my code in a "page" module or block though, by copy and pasting tutorial stuff off

http://api.drupal.org/api/file/developer/examples/page_example.module/5

so if you just want to hack into the template the "direct way" I can't help you.

Finally, the add_js function wants a good path (check that the generated page produces the js code else you typed a wrong path). The paths I use are like:

/site_root/sites/all/modules/my_new_module/js/blahblah.js