[Zope] Changing HTML tag attributes with ZPT macros

Sumiya Sakoda sakoda@toyoake.or.jp
Tue, 28 Jan 2003 12:02:05 +0900


hi,

;; Michael = Michael LaPera <michael@lapera.com>

Michael> I have a ZPT METAL macro slot for menu bar navigation.  The menu bars 
Michael> have JavaScript image mouseovers that I want to preload using the 
Michael> "onload" attribute in the body tag.

Michael> How can I change the images that I preload when I use different 
Michael> navigation in the slot?

how about this ?

Page Template
===============
<body tal:attributes="onLoad here/preload">
...
</body>

Python Script
===============
# preload
dirlist = ['a','b','c'] # or put values dynamically (as i do on my website)
result = "MM_preloadImages('" + string.join(map((lambda x: "menu_"+x+"_on.gif"), dirlist),"','") + "')"
return result

--

                                  Sumiya Sakoda <sakoda@toyoake.or.jp>