I am trying to be able to load JavaScript function when I load an article inside Joomla. In normal HTML coding that would be in the body using the onload event - there I would be able to load what ever I want including JS functions. i.e.
<body onload="myJSFunction()">
I am using Sorcerer to be able to write down the JS inside Joomla AS IS - But I could NOT be able to load the function when the article loads.
I would be happy to know the right way to load JS functions in Joomla Articles. I have managed to activate the JS using an OnClick event - that means the JS code works inside Joomla.
I would like that the event would be activated on Article load - Is there a way to do that? Is there a PHP code that can assist me with that? I have tried using this code with no luck - When My Article ID is 133. That code should have change the Joomla body to use the onload event when it meets Article ID number 133 - But, It did not work in Joomla at all and I did not get the onload event I wanted.
> <?php if ($_GET['id'] == 133) {
> $body = '<body onload="MyJSFunction()">';
> } else {
> $body = '<body>';
> } ?>
Please assist me with making this happen. Thanks in Advanced