• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

There are many occasions when one needs to add some javascript that requires something like

<body onLoad="dosomething">
(even some of the TWiki templates have an onLoad="initForm()" in the body tag.

I suggest to add a function akin to TWiki::addToHEAD that let's one collect up material to stuff into the onLoad attribute of the body tag.

I've got the code written, but before I update all the templates, I'd prefer some feedback.

-- TW

How about using a preferences variable instead? This gives TWiki applications the opportunity to manipulate the body tag. Such as a BODYTAGATTR setting in TWikiPreferences, initialized to an empty value. All skins would have somehing like <body class="patternViewPage" %BODYTAGATTR%>

-- PTh

Be careful with body onload handlers. Because many parts of a TWiki page want to have control over the onload (multiple plugins, the skin), we now use this method:

<script type="text/javascript">
   function myFunc () {
      // initializing code


AC, great advice. Works neat and does not require any new feature for TWiki. Thanks. -- TW

Documented in TWiki:TWiki.SkinsAndJavaScript. -- AC

Summary Need ability to write into <body> tag
ReportedBy TWiki:Main.ThomasWeigert
Codebase 4.0.0, 4.0.2, 4.0.4, 4.0.1, 4.0.3
SVN Range Wed, 12 Jul 2006 build 11001
AppliesTo Engine

Priority Enhancement
CurrentState No Action Required


TargetRelease n/a
Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r6 - 2006-07-18 - ArthurClemens
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback