[TYPO3-dev] howto add js function calls to body onload event
Martin Kutschker
Martin.Kutschker at n0spam-blackbox.net
Fri Sep 29 12:06:02 CEST 2006
Thomas Mammitzsch schrieb:
> Martin Kutschker schrieb:
>
>> Thomas Mammitzsch schrieb:
>>
>>> hi list,
>>>
>>> i try to call a Javascript function on the onLoad-Event. I found the
>>> following to do the job, but it doesn't work out (the body-tag is
>>> empty):
>>
>>
>> Is your plugin a USER_INT?
>>
>>> $GLOBALS['TSFE']->JSeventFuncCalls['onload']['myOnloadEvent']=
>>> 'my_function();';
>>>
>>> it seems to me, that the JS-Events are rendered by
>>> class.tslib_pagegen.php _before_ the $GLOBALS['TSFE']->JSeventFuncCalls
>>> array is filled from my Frontend-Plugin.
>>
>>
>> Works for USER objects, but not for USER_INTs.
>
> ok, that works, but what about USER_INTs?
You cannot do it. But you can make a workaround. Add a USER that adds an
onload handler. The handler does nothing but looks for the existence of a
certain JS function. If it finds it it calls it. Your USER_INT creates that
function on deman (within script tags in the html body).
Masi
More information about the TYPO3-dev
mailing list