adding an onload-Attribute to the Body-Tag of HTML

Description
DreiBaer
Posts: 9
Joined: Thu Oct 18, 2018 9:52 am

adding an onload-Attribute to the Body-Tag of HTML

Postby DreiBaer » Tue Oct 30, 2018 2:49 pm

Hi,

in my widget I have to put an onload-Attribute to the Body-Tag of the generated HTML-Page. But unfortunately I have no access to the Body-Tag. Can anyone tell me how to do this?


Best Regards
DreiBaer

DreiBaer
Posts: 9
Joined: Thu Oct 18, 2018 9:52 am

Re: adding an onload-Attribute to the Body-Tag of HTML

Postby DreiBaer » Tue Nov 13, 2018 3:31 pm

Hi,

you have to do this with a JavScript. And within the JavaScript you just directly execute teh function you want to have been executed.

Java-Code
HtmlTagBuilder script = builder.tag().byName("script");
script.attributes().byName("type", "text/javascript");
script.attributes().byName("src", myContext.resourceUrl("scripts/script.js"));


JavaScript-Code
(
function JsModuleDraggable()
{

...
function initializeButtons()
{
var button = document.getElementById("specialId");
button.addEventListener("click", handleButtonClick, false);
}

...

initializeButtons();
}
) ();


Return to “Polarion Application Lifecycle Management (ALM)”

Who is online

Users browsing this forum: No registered users and 10 guests