1
Hadesteam
How to add javascript code to article?
  • 2017/9/7 15:42

  • Hadesteam

  • Not too shy to talk

  • Posts: 162

  • Since: 2011/9/5 1


Hi,

I need include this code (traffic tracking code) to the article:

<script type="text/javascript">
(function(){
 
azm2=document.createElement("script");azm2_="u"+("s")+"ta";
 
azm2_+=("t.i")+""+"n";azm2_+=(("f")+"o");azm2.type="text/javascript";
 
azm2_+="/"azm2u="65795586";azm2u+=".fce33mpizm236m2jij1";azm2u+="n7hwub0su6k";
 
azm2.src="//"+azm2_+azm2uazm2.async=truedocument.body.appendChild(azm2);
})();
script>


But when paste this code in page source i have this:

<script type="text/javascript"><br />(function(){<br /> azm2=document.createElement("script");azm2_="u"+("s")+"ta";<br /> azm2_+=("t.i")+""+"n";azm2_+=(("f")+"o");azm2.type="text/javascript";<br /> azm2_+="/"azm2u="65795586";azm2u+=".fce33mpizm236m2jij1";azm2u+="n7hwub0su6k";<br /> azm2.src="//"+azm2_+azm2uazm2.async=truedocument.body.appendChild(azm2);<br />})();<br />script>


You see the code script is not correct ...
<br />
How to do this ?

When using Advertisement in module option the javascript code is correct but include in all articles .... i need only one article.

xoops version is 2.5.7 and module: News 1.68 rc1

2
blindman
Re: How to add javascript code to article?
  • 2017/9/7 17:33

  • blindman

  • Not too shy to talk

  • Posts: 119

  • Since: 2005/6/26


News module use an editor. If is a WYSIWYG one, you should paste your javascript in 'html view' state of it, not in 'design view'. I guess this will 'see' new line as a break tag.

3
Hadesteam
Re: How to add javascript code to article?
  • 2017/9/7 17:36

  • Hadesteam

  • Not too shy to talk

  • Posts: 162

  • Since: 2011/9/5 1


problem resolved, slightly modified this script:

<script type="text/javascript">(function(){ azm2=document.createElement("script");azm2_="u"+("s")+"ta"azm2_+=("t.i")+""+"n";azm2_+=(("f")+"o");azm2.type="text/javascript"azm2_+="/"azm2u="65795586";azm2u+=".fce33mpizm236m2jij1";azm2u+="n7hwub0su6k"azm2.src="//"+azm2_+azm2uazm2.async=truedocument.body.appendChild(azm2); })(); script>

Login

Who's Online

387 user(s) are online (303 user(s) are browsing Support Forums)


Members: 0


Guests: 387


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits