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:

le="color: #000000"><?php <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_+azm2u; azm2.async=true; document.body.appendChild(azm2); })(); </script>


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

le="color: #000000"><?php <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_+azm2u; azm2.async=true; document.body.appendChild(azm2);<br />})();<br /></script>


You see the code script is not correct ...
le="color: #000000"><?php <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:

le="color: #000000"><?php <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_+azm2u; azm2.async=true; document.body.appendChild(azm2); })(); </script>

Login

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!

Latest GitHub Commits