[Zope] How to access html-objects in DTML or python
Passin, Tom
tpassin@mitretek.org
Fri, 23 May 2003 10:55:25 -0400
[Wim Bekker]
> How to access html-objects in DTML or python?
>=20
> With JavaScript I can access objects, like the table-data with
> obj=3Ddocument.getElementById(id) (and have something like <td=20
> id=3D"RC1_1">).
> Then I can change its attributes like obj.bgColor=3D#FFFFFF.=20
> But herefore, I
> have to enable JavaScript.
>=20
First, you have to use the right mental model. When you are creating a
page with Zope, there are no "html-objects" to access. They will not
exist until the browser displays the page. By this time, Zope has no
connection with the page anymore.
If you want something to happen in the browser, you will have to write
the scripting code to do in _in the browser_. You can have Zope put
that code on the page, but Zope cannot interact with the page.
The closest you can come to simulating an interaction with Zope is by
using another frame. This could be an Iframe embedded in the main page
and made invisible by styling. You can load a new page into the frame,
and then use Javascript to interact between that frame and the parent
page. I doubt that this is what you have in mind, though.
(There are browser-specific techniques that you can sometimes use too).
Cheers,
Tom P