[Zope] Q: onLoad + onUnload...?

3dfestival - WebMaster thomas@3dfestival.com
Mon, 30 Apr 2001 13:14:40 +0200


My prob:
I want to make a variable in DTML which counts the user online....

I actually did do it, but in a crappy way:


<body onLoad="addUser();" onUnload="subUser();">

and I had made to functions in javscript:

function addUser()
{
self.open('addU', 'counting users');
}

function subUser()
{
self.open('subU', 'counting users');
}

and to DTML-methods

=====
addU
=====
<html><head>
<dtml-call "REQUEST.set ('uc, uc+1)">
<script language="javascript">
<!--self.close();--></script>
</head><body></body></html>
=====
subU:
=====
<html><head>
<dtml-call "REQUEST.set ('uc, uc-1)">
<script language="javascript">
<!--self.close();--></script>
</head><body></body></html>
=====

and I added a porperty (integer) called uc...

It worked fine, but it was very irritating for the users that a new window
woukd open and then close every time the went from one place to another....

Now to my Q:

Is there some way to do this javascript in DTML or PYTHON....?
If so: How...?

( = Stoons = )
 - Webmaster @ 3D festival (http://www.3dfestival.com)