By clm23 on
Hi,
it looks like this is a recurring topic
http://drupal.org/node/126240
but I can't find any answers!
What's the easiest way to include javascript in a block ?
Thanks,
C
Hi,
it looks like this is a recurring topic
http://drupal.org/node/126240
but I can't find any answers!
What's the easiest way to include javascript in a block ?
Thanks,
C
Comments
ps.
PS,
I'm trying to get google's conversion tracking enabled on our site,
and google keeps saying " couldn't find code or the code wasn't pasted
properly.
When I view the enabled pages source, the javascript does show up.
so a)
Now do I know that the javascript is really working ?
( I guess I could use JS to write some text to the page)
and
b)
There is also some javascript from the googleanalytics module.
Could that be interfering with the conversion tracking -
What's the debugging procedure for even determining what's the problem ?
Thanks,
could be your input filter,
could be your input filter, when you view source does each line of JavaScipt end in a
<br />tag?If so you need to use an input filter that doesn't include the Line break converter.
www.sitespring.eu
Pimp your Drupal 8 Toolbar - make it badass.
Adaptivetheme - theming system for people who don't code.
The original google code,
The original google code, was clean of
tags
but the "final" page source has some
tags
I'm using "full html" as the (lack of) input filter (excerpt below),
so by "input filter" do you mean something other than the
"partial html", "php", "full html" input format option that drupal provides?
Thanks much!
it's the line break converter...
Those additional paragraph and line break tags are being added by the line break converter input filter.
To turn that off for full html go to:
Administer > Site configuration > Input formats (admin/settings/filters)
Click configure on the Full HTML input format, scroll down and un-check 'Line break converter' from the filters list.
Another way is to add a new Input Format - click the 'Add input format' tab, give it a name e.g. 'Scripts', select the roles that can use it (I suggest restricting this to an admin type role only), and click save - dont check any of the filters.
Go back and edit your block and select the new 'Scripts' input format and badda bing badda boom, it will be working.
Just remember there is no input filtering on that Input Format at all, so you do not want anyone but yourself or a trusted admin using it - btw if you do not select a role, only user1 can access that format...
Pimp your Drupal 8 Toolbar - make it badass.
Adaptivetheme - theming system for people who don't code.
worked great. Thanks!
worked great.
Thanks!
thank you so much for this, I
thank you so much for this, I was going crazy not being able to figure out how to get js to work in nodes.
it worked,
Whats the best way to mix up, PHP, Javascript and HTML all in a node
any help much appreciated,
Integrating a JS image swap, need help
using Drupal 5.7
www.fenariogallery.com/artists
Here is the imageswap code I am attempting to integrate into a block:
And then using css calls to ac tivate the swap:
The code breaks and so the swap obviously doesn't work.
The page spits out a bit of broken JS
Screenshots:
http://i27.photobucket.com/albums/c181/playonpro/Picture1.png
http://i27.photobucket.com/albums/c181/playonpro/Picture2-1.png
Any advice on making this JS code work in a Drupal block?
is the code incompatible with druapl?
do I need to shlep it into an external .js file?
----~---~---^---~---~----
JesseLiberty
www.loftkilla.com
www.fenariogallery.com