[Zope] Some questions for experienced zopers

Johan Carlsson johanc@torped.se
Tue, 19 Oct 1999 01:32:01 +0200


> I've got two pressing questions that I can't seem to find answers 
> to on zope.org:
> 
> 1.  What is the relationship that dtml has (if any) to 
> javascript?  Specifically,
> I want to do onmouseover swapping of a .gif.  It seems to me that 
> it would be simple with dtml, something like
>     <dtml-if img1 mouseover == true>
>        <dtml-var img2>
>    <dtml-else>
>        <dtml-var img1>
>    </dtml-if>
> 
> but I can't find a reference to any such functions.  Otherwise, 
> what is the best way to integrate js and dtml? 
> (Sorry for any syntax errors, I'm just starting out)

Nothing readymade I'm afraid, but;

The image object supports a tag() method:

Usage: <dtml-var "img1.tag(height=1,width=1,alt='Hello')">

Any other key:value arguments while be written as key:values
inside the img-tag.

<dtml-var "img1.tag(onClick='callClcFunc();')">
or
<dtml-var "img1.tag(onClick=alert(\'Hello world\');')">

Notice that you must escape the ' inside strings.

I hope this helps you?
Best regards,
Johan Carlsson