How to use javascript in articles?

For Joomla! 1.5 Coding related discussions, please use: http://groups.google.com/group/joomla-dev-general
click2grow
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Sat Feb 20, 2010 12:15 am

Re: How to use javascript in articles?

Post by click2grow » Sat Feb 20, 2010 12:31 am

mssmtih13 wrote:Hey click2grow...can you post the javascript code your using (of course removing any identifiable information from it first)
<script type="text/javascript" src="swfobject.js"></script>
<div id="index">
Upgrade your Flash Player to version 8 to view this video! (<a href=http://fpdownload.macromedia.com/get/fl ... player.exe target=_blank>Click here for the download</a>)
</div>
<script type="text/javascript">
var so = new SWFObject("RolloverPlayer.swf?path=http://www.Click2Grow.com/media/video/M ... &redirect=", "index", "420", "340", "8", "#ffffff");
so.write("index");</script>


followed by

<script type="text/javascript" src="swfobject.js"></script>
<div id="index">
Upgrade your Flash Player to version 8 to view this video! (<a href=http://fpdownload.macromedia.com/get/fl ... player.exe target=_blank>Click here for the download</a>)
</div>
<script type="text/javascript">
var so = new SWFObject("RolloverPlayer.swf?path=http://www.Click2Grow.com/media/video/b ... &redirect=", "index", "420", "340", "8", "#ffffff");
so.write("index");</script>

click2grow
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Sat Feb 20, 2010 12:15 am

Re: How to use javascript in articles?

Post by click2grow » Sat Feb 20, 2010 9:43 pm

mssmtih13 wrote:
click2grow wrote:I'm trying to add 2 flash videos to a page via java script. When I put 1 on the page it works just fine. When I put both on the page only the first one alphabetically plays regardless of which one is first on the page. I get the same result inserting through JCE and Sourcer.

Here is the page: http://www.click2grow.com/video-marketing.html

/media/video/MassageByJJ.FLV is the first one on the page, but when I put both java script codes in the same article only this one Plays:

/media/video/bellwether.FLV

Right now both JS code has been inserted using sourcer and I get the same problem. I contacted my hosting company and they said I'm missing a plugin for joomla to make them both run. That's when I tried sourcer and I'm still stuck.
Hey click2grow...can you post the javascript code your using (of course removing any identifiable information from it first)
click2grow wrote:<script type="text/javascript" src="swfobject.js"></script>
<div id="index">
Upgrade your Flash Player to version 8 to view this video! (<a href=http://fpdownload.macromedia.com/get/fl ... player.exe target=_blank>Click here for the download</a>)
</div>
<script type="text/javascript">
var so = new SWFObject("RolloverPlayer.swf?path=http://www.Click2Grow.com/media/video/M ... &redirect=", "index", "420", "340", "8", "#ffffff");
so.write("index");</script>


followed by

<script type="text/javascript" src="swfobject.js"></script>
<div id="index">
Upgrade your Flash Player to version 8 to view this video! (<a href=http://fpdownload.macromedia.com/get/fl ... player.exe target=_blank>Click here for the download</a>)
</div>
<script type="text/javascript">
var so = new SWFObject("RolloverPlayer.swf?path=http://www.Click2Grow.com/media/video/b ... &redirect=", "index", "420", "340", "8", "#ffffff");
so.write("index");</script>
Someone else I spoke with suggested designating var so1 and var so 2 with so1.write and so2.write, but that didn't work either. I decided just to make a playlist instead of having two scripts and that works fine.

agilitycns
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Thu Jan 06, 2011 10:30 pm
Contact:

Re: How to use javascript in articles?

Post by agilitycns » Thu Jan 06, 2011 10:49 pm

This thread was a huge help in getting Google Multivariant Testing to work in Joomla 1.5. Adding 'Allow Javascript' was the final key. This allowed javascript (kind of hidden in the groups section of the JCE editor control panel) into the articles to accept the Google code needed for Multivariant testing. I also have phpInclude up and running so I'm not sure if this helped also. Thank you!
C.
Chandler
Chicago, Illinois
http://www.agilitynetworks.com

fcelio
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Tue Apr 19, 2011 1:19 am

Re: How to use javascript in articles?

Post by fcelio » Tue Apr 19, 2011 1:53 am

K so where is the enable java script button. Ive been reading this yet when i get intpo joomla i do not see it as described.

mido203
Joomla! Apprentice
Joomla! Apprentice
Posts: 25
Joined: Mon Jun 22, 2009 5:05 pm

Re: How to use javascript in articles?

Post by mido203 » Sat Apr 30, 2011 1:35 pm

always18 wrote:Hi guys,

I have better solution for this problem. No need to choose No WYSIWYG editor in global configuration of site. You can also write javascript in articles using default editor(TinyMCE 2.0).

Steps ->

Go to plugin manager & click on TinyMCE 2.0
Go to plugin parameters
select " never " to Code cleanup on save option & save it.
Now you can write your javascript in articles(joomla).

I hope it ll be useful for you all.

Regards,
Always18
It works !
Thank you very much

fcelio
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Tue Apr 19, 2011 1:19 am

Re: How to use javascript in articles?

Post by fcelio » Sat Apr 30, 2011 8:58 pm

Unfortunately this is not working for me. I get a blank page for the article with only the article heading???????

brutalicious
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Thu May 19, 2011 12:06 pm

Re: How to use javascript in articles?

Post by brutalicious » Fri Jul 15, 2011 3:09 pm

i was having problems here but turned off jce pasted the code then turned jce back on worked however the images i wanted to display weren't perfect (http://milesandbarrcashforcharity.co.uk/argos.html) the argos search box on the top left should have the blue border all around the searchbox :(

marfic
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Tue Jul 19, 2011 7:52 pm

Re: How to use javascript in articles?

Post by marfic » Tue Jul 19, 2011 7:58 pm

Guys, your posts are very helpful. Thanks for keeping us up to date.



Marfic Technologies
www.marfic.com
Milpitas, CA

dchktester
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Fri Feb 03, 2012 5:08 am

Re: How to use javascript in articles?

Post by dchktester » Fri Feb 03, 2012 5:11 am

always18 wrote:Hi guys,

I have better solution for this problem. No need to choose No WYSIWYG editor in global configuration of site. You can also write javascript in articles using default editor(TinyMCE 2.0).

Steps ->

Go to plugin manager & click on TinyMCE 2.0
Go to plugin parameters
select " never " to Code cleanup on save option & save it.
Now you can write your javascript in articles(joomla).

I hope it ll be useful for you all.

Regards,
Always18
It doesn't work for me :'(

coolgrafix
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Tue Jan 12, 2010 6:46 pm

Re: How to use javascript in articles?

Post by coolgrafix » Fri Mar 02, 2012 3:59 pm

Guys, the definite guide to enabling JavaScript insertion with JCE is provided at the JCE site here:

http://www.joomlacontenteditor.net/supp ... -on-saving

Covers Joomla 1.5, 1.7, and 2.5.

Spent a goodly amount of time on this issue myself until I found this nugget.

For Joomla 2.5, it was two simple steps... the settings in the JCE configuration (which is, yes, buried), and also Joomla 2.5's text filter settings.

--Brad =)

tophatmoney
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Mon Jan 28, 2013 2:13 pm
Location: UK
Contact:

Re: How to use javascript in articles?

Post by tophatmoney » Mon Jan 28, 2013 2:22 pm

Hi, I got it working too thanks to this thread.

It was similar to the simple 'turn code cleanup off' option but not the same so in case anyone else is struggling this is what worked for me.

1. Extensions > Plug in Manager
2. Editor - TinyMCE
3. Basic functionality > Prohibited Elements
4. Listed as 'Prohibited Elements' => "script, applet, iframe"
5. I simply removed 'script' from this list and I can type / copy&paste js script directly into the article editor and it is not stripped out on save.

Thanks for the help.
T

chattwo
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Tue Jun 30, 2009 2:03 am

Re: How to use javascript in articles?

Post by chattwo » Sun Feb 03, 2013 5:28 pm

Hi,
I run joomla 1.5.26
editor >> no editor enabled
You do not have the required permissions to view the files attached to this post.


Locked

Return to “Joomla! 1.5 Coding”