How to use javascript in articles?
-
- Joomla! Apprentice
- Posts: 20
- Joined: Thu Jun 12, 2008 11:21 am
How to use javascript in articles?
Hi,
I have a problem to show javascript or iframe codes in articles.
i am a little bit surprised that response is not really coming. It can't be that difficult as i excpect that i am not the only one who is using this type of codes? Can someone please inform me how i can display a banner that is using the following typ of code.
<script type="text/javascript">
var uri = 'http://impnl.tradedoubler.com/imp?type( ... a(1532223)' + new String (Math.random()).substring (2, 11);
document.write('<sc'+'ript type="text/javascript" src="'+uri+'" charset="ISO-8859-1"></sc'+'ript>');
</script>
I run joomla 1.5.3
editor >> no editor enabled
Thanx
I have a problem to show javascript or iframe codes in articles.
i am a little bit surprised that response is not really coming. It can't be that difficult as i excpect that i am not the only one who is using this type of codes? Can someone please inform me how i can display a banner that is using the following typ of code.
<script type="text/javascript">
var uri = 'http://impnl.tradedoubler.com/imp?type( ... a(1532223)' + new String (Math.random()).substring (2, 11);
document.write('<sc'+'ript type="text/javascript" src="'+uri+'" charset="ISO-8859-1"></sc'+'ript>');
</script>
I run joomla 1.5.3
editor >> no editor enabled
Thanx
-
- Joomla! Apprentice
- Posts: 20
- Joined: Thu Jun 12, 2008 11:21 am
Dissapointed?
Although the topic has been read already 35 times i am rather surprised that no one of the joomla community is able to answer this,to my opinion, simple question, Simple meaning if you know something about coding ofcourse. I wonder if I have submitted this topic in the wrong section. Is there another section maybe where the coders are who know how to solve this issue??
Help would be very appreciated.
Thanx
Help would be very appreciated.
Thanx
-
- Joomla! Apprentice
- Posts: 18
- Joined: Thu Jan 10, 2008 9:07 am
Re: How to use javascript in articles?
Hi Markyboy !
to use Javascript you can use JCE as WYSIWYG
this one allow javascript use into articles and it's free
Download plug-in, component and JCE Utilities on the website http://www.joomlacontenteditor.net/
(you have to register for downloading)
After installation go to Administrator and access Components > JCE Administrator > Configuration
and set Allow javascript to Yes
You can althought create users groups with specific rights.
So past your script and enjoy !
to use Javascript you can use JCE as WYSIWYG
this one allow javascript use into articles and it's free

Download plug-in, component and JCE Utilities on the website http://www.joomlacontenteditor.net/
(you have to register for downloading)
After installation go to Administrator and access Components > JCE Administrator > Configuration
and set Allow javascript to Yes

You can althought create users groups with specific rights.

So past your script and enjoy !
-
- Joomla! Apprentice
- Posts: 20
- Joined: Thu Jun 12, 2008 11:21 am
Re: How to use javascript in articles?
Hi Antoine,
Thanks for the information provided. I have installed the JCE component, plugin & utilities.
I have enabled the JCE editor in Global Configuration.
I have allow javascript set to "yes"
I have implemented the code by using the <> html icon
I updated the content file and saved.
Still no correct showing on the site?? I have no idear why?
It looks like this.
http://travel2.gr/index.php?option=com_ ... Itemid=216
The good news is that it doesn't mess up the codes anymore.
Any other suggestions?
Thanks for your help.
Markyboy
Thanks for the information provided. I have installed the JCE component, plugin & utilities.
I have enabled the JCE editor in Global Configuration.
I have allow javascript set to "yes"
I have implemented the code by using the <> html icon
I updated the content file and saved.
Still no correct showing on the site?? I have no idear why?

It looks like this.
http://travel2.gr/index.php?option=com_ ... Itemid=216
The good news is that it doesn't mess up the codes anymore.

Any other suggestions?
Thanks for your help.
Markyboy
-
- Joomla! Apprentice
- Posts: 18
- Joined: Thu Jan 10, 2008 9:07 am
Re: How to use javascript in articles?
Ok, you should try to set Groups preferences and add your account. Maybe this overwrite your JCE configuration params.
You can access it via Components > JCE Administrator > Groups
If you are not sure for manipulation, you can create a new group and add your account.
I'm not sure this will work but it could be helpful
Keep me informed of issues
You can access it via Components > JCE Administrator > Groups
If you are not sure for manipulation, you can create a new group and add your account.
I'm not sure this will work but it could be helpful

Keep me informed of issues
-
- Joomla! Apprentice
- Posts: 20
- Joined: Thu Jun 12, 2008 11:21 am
Re: How to use javascript in articles?
Hi,
i tried to add a new user.. although i get the message that it is saved i also see the following error message

Markyboy
i tried to add a new user.. although i get the message that it is saved i also see the following error message
Going again to groups will give the same error message.DB function failed with error number 1054
Unknown column 'a.name' in 'order clause' SQL=SELECT g.*, u.name AS editor FROM jos_jce_groups AS g LEFT JOIN jos_users AS u ON u.id = g.checked_out GROUP BY g.id ORDER BY a.name , g.ordering ASC LIMIT 0, 20

Markyboy
-
- Joomla! Apprentice
- Posts: 18
- Joined: Thu Jan 10, 2008 9:07 am
Re: How to use javascript in articles?
Wouah !
never seen this yet ! I use JCE for a long time and groups function works well on my server.
Check on JCE forum, maybe there is a previous case
JCE Forum : http://www.joomlacontenteditor.net/inde ... &Itemid=63
Keep me informed

never seen this yet ! I use JCE for a long time and groups function works well on my server.
Check on JCE forum, maybe there is a previous case
JCE Forum : http://www.joomlacontenteditor.net/inde ... &Itemid=63
Keep me informed

-
- Joomla! Apprentice
- Posts: 20
- Joined: Thu Jun 12, 2008 11:21 am
Re: How to use javascript in articles?
First a critical note:
I want to point out again that there is very little support from joomla coders around here. Many components, plugins etc. are not working properly or have conflicts in different surroundings and settings. As a joomla user this gets extremely frustrating, so some help or advice from the makers would be very much appreciated.
After pulling my hair out for 3 days i had made a small improvement for showing some javascript in the content.
I managed to show some javascript using joomlaFCK editor
To do this i had to disable the plugin content -embed
This is now the only way to see at least something.
http://travel2.gr/index.php?option=com_ ... &Itemid=81
But adding more than one script is messing up things again. It removes the content title and some other strange errors appear .
Anyone has an idear?
Marc
I want to point out again that there is very little support from joomla coders around here. Many components, plugins etc. are not working properly or have conflicts in different surroundings and settings. As a joomla user this gets extremely frustrating, so some help or advice from the makers would be very much appreciated.
After pulling my hair out for 3 days i had made a small improvement for showing some javascript in the content.
I managed to show some javascript using joomlaFCK editor
To do this i had to disable the plugin content -embed
This is now the only way to see at least something.
http://travel2.gr/index.php?option=com_ ... &Itemid=81
But adding more than one script is messing up things again. It removes the content title and some other strange errors appear .
Anyone has an idear?
Marc
-
- Joomla! Enthusiast
- Posts: 111
- Joined: Sat Jun 14, 2008 11:24 pm
Re: How to use javascript in articles?
ha, good to know that 

-
- Joomla! Apprentice
- Posts: 7
- Joined: Sun Jun 08, 2008 5:18 pm
Re: How to use javascript in articles?
From looking at your page, it's seems like you found a solution? Care to share it? I'm have the same problem 

-
- Joomla! Fledgling
- Posts: 1
- Joined: Fri Aug 15, 2008 2:17 am
Re: How to use javascript in articles?
JCE worked great for me but I accidentally skipped enabling it is as the wysiwyg editor at first and was having some problems of course. I know it was mentioned as a step on this forum but just in case someone else forgets that was my only problem.
- drakeone69
- Joomla! Intern
- Posts: 52
- Joined: Wed Feb 18, 2009 2:50 pm
- Location: Toronto
- Contact:
Re: How to use javascript in articles?
Hi Alepee; without your assistance I would have never got the dang thing working lol 
but I have one question.
Do you know why it would in the JA_Purity template post the article that I inserted some javascript code into, why would it post it all the way over to the right hand side but ONLY in firefox? it's quite odd and I don't know why, it works fine in IE
http://www.ubetterbuy.com

but I have one question.
Do you know why it would in the JA_Purity template post the article that I inserted some javascript code into, why would it post it all the way over to the right hand side but ONLY in firefox? it's quite odd and I don't know why, it works fine in IE
http://www.ubetterbuy.com
-
- Joomla! Enthusiast
- Posts: 102
- Joined: Wed Aug 02, 2006 1:37 am
Re: How to use javascript in articles?
Hi guys,
Do you know how I can use javascript but in modules? I have JCE and it doesn't work.
Do you know how I can use javascript but in modules? I have JCE and it doesn't work.
-
- Joomla! Explorer
- Posts: 331
- Joined: Mon Aug 04, 2008 8:00 am
- Location: India
- Contact:
Re: How to use javascript in articles?
hi
try no editor.... it is simple, already installed and no side effects...it does work like a charm....
set the user editor to no editor... and switch back when done....
i know it is a crude solution...
sumeet
try no editor.... it is simple, already installed and no side effects...it does work like a charm....
set the user editor to no editor... and switch back when done....
i know it is a crude solution...
sumeet
Sumeet Shroff
PSD to Joomla, Joomla Custom Template Design and Virtuemart Shopping Cart
http://www.prateeksha.com http://www.joomlawebsitedesigners.com
PSD to Joomla, Joomla Custom Template Design and Virtuemart Shopping Cart
http://www.prateeksha.com http://www.joomlawebsitedesigners.com
-
- Joomla! Apprentice
- Posts: 16
- Joined: Wed Oct 25, 2006 2:34 am
Re: How to use javascript in articles?
Crude but very effect. Worked like a charm for me. Thanks!prateekshaweb wrote:hi
try no editor.... it is simple, already installed and no side effects...it does work like a charm....
set the user editor to no editor... and switch back when done....
i know it is a crude solution...
sumeet
-
- Joomla! Fledgling
- Posts: 4
- Joined: Fri Aug 21, 2009 5:03 am
Re: How to use javascript in articles?
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
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
-
- Joomla! Intern
- Posts: 56
- Joined: Fri Apr 03, 2009 9:33 am
Re: How to use javascript in articles?
Thank you, always18! I have had so much trouble with the editor and I didn't know there was an option to turn off the cleanup (which seems mostly to be a 'dirtyup' or a 'break it'). Even just having my line breaks remain is so lovely, thank you again!
-
- Joomla! Explorer
- Posts: 331
- Joined: Mon Aug 04, 2008 8:00 am
- Location: India
- Contact:
Re: How to use javascript in articles?
yes..it is good...
but there is a plugin Sourcer...that allows you to add css and script code to your code...works like a charm and with all editors
but there is a plugin Sourcer...that allows you to add css and script code to your code...works like a charm and with all editors
Sumeet Shroff
PSD to Joomla, Joomla Custom Template Design and Virtuemart Shopping Cart
http://www.prateeksha.com http://www.joomlawebsitedesigners.com
PSD to Joomla, Joomla Custom Template Design and Virtuemart Shopping Cart
http://www.prateeksha.com http://www.joomlawebsitedesigners.com
-
- Joomla! Intern
- Posts: 56
- Joined: Fri Apr 03, 2009 9:33 am
Re: How to use javascript in articles?
Thanks - I'll give that a try.
I actually found I had to switch to "No Editor" (set it for the user under User Manager) to get the script to work. But the "never cleanup" is such a help anyway.
I actually found I had to switch to "No Editor" (set it for the user under User Manager) to get the script to work. But the "never cleanup" is such a help anyway.
-
- Joomla! Intern
- Posts: 56
- Joined: Fri Apr 03, 2009 9:33 am
Re: How to use javascript in articles?
I've installed sourcerer, and it is enabled, but it doesn't seem to work. I have pasted in my code at the end of the article, and surrounded it by tags (I thought there should be a button in the editor, but there isn't)
{source}<script type = "text/javascript" src = "/wychwoodcats/templates/my_javascript/calculator_utilities.js"></script>
<script type = "text/javascript" src = "/wychwoodcats/templates/my_javascript/due_date.js"></script>{/source}
But when I save the HTML and then reopen, MCE has messed it up again:
<p>{source}<mce:script type="text/javascript" src="/wychwoodcats/templates/my_javascript/calculator_utilities.js"></mce:script>
<mce:script type="text/javascript" src="/wychwoodcats/templates/my_javascript/due_date.js"></mce:script>{/source}</p>
Any ideas, anybody?
{source}<script type = "text/javascript" src = "/wychwoodcats/templates/my_javascript/calculator_utilities.js"></script>
<script type = "text/javascript" src = "/wychwoodcats/templates/my_javascript/due_date.js"></script>{/source}
But when I save the HTML and then reopen, MCE has messed it up again:
<p>{source}<mce:script type="text/javascript" src="/wychwoodcats/templates/my_javascript/calculator_utilities.js"></mce:script>
<mce:script type="text/javascript" src="/wychwoodcats/templates/my_javascript/due_date.js"></mce:script>{/source}</p>
Any ideas, anybody?
-
- Joomla! Intern
- Posts: 56
- Joined: Fri Apr 03, 2009 9:33 am
Re: How to use javascript in articles?
I think I've got it working now - the button is at the bottom of the screen not in the toolbar. And in the Sourcerer editor, I turned off "colorize tags". Thanks.
-
- Joomla! Explorer
- Posts: 331
- Joined: Mon Aug 04, 2008 8:00 am
- Location: India
- Contact:
Re: How to use javascript in articles?
hi.. little brain...
there is a module called "custom code"... it is similar to Custom html but that module allows all script and css also php code....
it is comes very handy ...try it
there is a module called "custom code"... it is similar to Custom html but that module allows all script and css also php code....
it is comes very handy ...try it
Sumeet Shroff
PSD to Joomla, Joomla Custom Template Design and Virtuemart Shopping Cart
http://www.prateeksha.com http://www.joomlawebsitedesigners.com
PSD to Joomla, Joomla Custom Template Design and Virtuemart Shopping Cart
http://www.prateeksha.com http://www.joomlawebsitedesigners.com
-
- Joomla! Intern
- Posts: 56
- Joined: Fri Apr 03, 2009 9:33 am
Re: How to use javascript in articles?
Does anybody know a way to stop Sourcerer from inserting <br> tags at the end of lines? It's a right pain because it invalidates the XHTML!
-
- Joomla! Fledgling
- Posts: 1
- Joined: Tue Sep 22, 2009 2:50 pm
Re: How to use javascript in articles?
hi all
i am a joomla newbie, so sorry for noobish questions..
i want to create a simple website with a prominent download button in the front page.
i am able to use a javascript to detect the visitors os and download the coressponding file, if i use "text" as the clickable entity..
however if i try to use an image instead, it doesnt show the image using document.write();
please point out some way to do it.
it would be nice if i am able to create a large and prominent button with the required javascript actind when it is pressed.
how can i use sourcerer for this?
thanx in advance
i am a joomla newbie, so sorry for noobish questions..
i want to create a simple website with a prominent download button in the front page.
i am able to use a javascript to detect the visitors os and download the coressponding file, if i use "text" as the clickable entity..
however if i try to use an image instead, it doesnt show the image using document.write();
please point out some way to do it.
it would be nice if i am able to create a large and prominent button with the required javascript actind when it is pressed.
how can i use sourcerer for this?
thanx in advance
-
- Joomla! Fledgling
- Posts: 1
- Joined: Fri Aug 07, 2009 12:12 pm
Re: How to use javascript in articles?
Using java script is depend on there site page. First check that and then find out what working for them.
-
- Joomla! Apprentice
- Posts: 9
- Joined: Sun Nov 15, 2009 12:01 am
- Contact:
Re: How to use javascript in articles?
The tip about JCE configuration works like a charm! Cheers! I used it on http://www.sailingchannel.gr to add the facebook badge on the side
-
- Joomla! Fledgling
- Posts: 1
- Joined: Thu Jul 30, 2009 11:02 am
Re: How to use javascript in articles?
You may try to solve this problem via reading this article:
http://docs.joomla.org/Why_does_some_HT ... n_1.5.8%3F
I find this really useful cause it solved my problem of using javascript in articles.
http://docs.joomla.org/Why_does_some_HT ... n_1.5.8%3F
I find this really useful cause it solved my problem of using javascript in articles.

-
- Joomla! Apprentice
- Posts: 5
- Joined: Sat Feb 20, 2010 12:15 am
Re: How to use javascript in articles?
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.
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.
-
- Joomla! Fledgling
- Posts: 2
- Joined: Fri Feb 19, 2010 11:59 pm
Re: How to use javascript in articles?
Vispi...the document.write method is usually only used during the page load event of a web page. I beleive that if you are putting javascript in the article body then the page load event has already finished by the time it runs your code. A more tradititional way of dynamically adding elements to a page would be:vispi wrote:hi all
i am a joomla newbie, so sorry for noobish questions..
i want to create a simple website with a prominent download button in the front page.
i am able to use a javascript to detect the visitors os and download the coressponding file, if i use "text" as the clickable entity..
however if i try to use an image instead, it doesnt show the image using document.write();
please point out some way to do it.
it would be nice if i am able to create a large and prominent button with the required javascript actind when it is pressed.
how can i use sourcerer for this?
thanx in advance
Code: Select all
var el = document.createElement('input');
el.type = 'button';
el.value = 'Download';
Code: Select all
el.onclick = myFunction();
Code: Select all
var afterMe = document.getElementById(someId);
afterMe.appendChild(el);
-
- Joomla! Fledgling
- Posts: 2
- Joined: Fri Feb 19, 2010 11:59 pm
Re: How to use javascript in articles?
Hey click2grow...can you post the javascript code your using (of course removing any identifiable information from it first)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.