Javascript in Article or Module

  • Bouky
    Inactive member
  • Topic Author
  • Member
  • Member
More
12 years 11 months ago - 12 years 11 months ago #13621 by Bouky
Hi,
I would like to add a simple javascript to display some live scores on my page. To do this I tried to add this code in an Article (via Article manager new article) but it displays nothing. When I save the code and open it again, the code is not there.
Please help me to display the resulat of this script:
Code:
<script type="text/javascript" src="http://knvbwidget.sportlink.com/widget_js.php?soort=vereniging-staand&clubcode=ABC123&breedte=180"> </script> <script type="text/javascript"> showWidget(); </script>

Cheers,
Bouky
Last edit: 12 years 11 months ago by Bouky.

Please Log in to join the conversation.

More
12 years 11 months ago #13637 by ivan.milic
You have to allow javascript , check Editor Plugin settings. It can be tiny MCE or JCEdit first check which one you are using. Beside obius options check options like slowed Tags.

Any way if you do not succeed you can just add that script in index.php of template in head section.

But in that case you would probably want to limit that on certain page, so modify second script like this:

window.onload = function(){
if(document.getElementById('dummyTrigger')){
showWidget();
}
};

and in your article just add this:

<div id="dummyTrigger" style="display:none;">
</div>


so that article triggers widget on some page.

Please Log in to join the conversation.

  • Bouky
    Inactive member
  • Topic Author
  • Member
  • Member
More
12 years 11 months ago - 12 years 11 months ago #13728 by Bouky
Hi Ivan, thank you for you help. via de configuration setting I tried all the three editor options: Editor-CodeMirror, Editor none and Editor Tiny MCE. The java script disappears and only this code remains:showWidget();

So i tried the second option: added code below to index.php of the template:
Code:
<!-- Widget Programma voetbal.nl --> <script type="text/javascript" src="http://knvbwidget.sportlink.com/widget_js.php?soort=vereniging-liggend&clubcode=BBGV594&hoogte=400&breedte=750"> </script> <script type="text/javascript"> window.onload = function(){ if(document.getElementById('dummyTrigger')){ showWidget(); } }; </script>


Then I added in my article this code (like you said):
Code:
<div id="dummyTrigger" style="display:none;"> </div>


This works oke! But the other content of the article disappears. Also the module on this page is gone! When I refresh the page the content and other module are displayed for 2 seconds and disappear again:)

What I want is just embedding this application (script) on the page including other content and modules!

Please see the current results: gscesdo.nl/gscesdo/index.php/programma/programma-zondag

Thanx in advance,
Bouky
Last edit: 12 years 11 months ago by Bouky.

Please Log in to join the conversation.

More
12 years 11 months ago #13734 by ivan.milic
Ok you sent false code in first block and i did not notice it. Remove it:

<script type="text/javascript"
src=" knvbwidget.sportlink.com/widget_js.php?s...ogte=400&breedte=750 ">
</script>

should be removed.

Please Log in to join the conversation.

  • Bouky
    Inactive member
  • Topic Author
  • Member
  • Member
More
12 years 11 months ago #13750 by Bouky
hi Ivan,

I do not understand you. What do you mean with false code? Which part should be removed? What is the correct code then and what should be the total solution?
I'm very sorry for not understanding this..

Please Log in to join the conversation.

More
12 years 11 months ago #13756 by ivan.milic
Yes I'am wrong about that. Try this instead of:
Code:
window.onload = function(){ if(document.getElementById('dummyTrigger')){ showWidget(); } };

put just:
Code:
if(document.getElementById('dummyTrigger')){ showWidget(); }

Please Log in to join the conversation.

Time to create page: 0.164 seconds
Powered by Kunena Forum