By wayland on
Hello everyone,
I want to create a new block with this code inside.
<script type="text/javascript" language="JavaScript" src="http://hypem.com/playlist/time/today/js/1/hype.js"></script>
It doesn't work.
I tried to found an answer in this forum but nothing works.
Can anyone help me?
Comments
Try using the PHP input format
If you use the PHP input format the javascript will not be filtered out (both HTML filtered and HTML strip out any javascript)
That doesn't work
That doesn't work either.
Does anyone uses javascript directly into Drupal?
Is there anyway I can write this in an other way compatible with drupal?
This would do a great module showing this web site into a module : http://hypem.com/
<script type="text/javascript" language="JavaScript" src="http://hypem.com/playlist/time/today/js/1/hype.js"></script>Create a new input format
This is probably a little bit late, You can create a new input format to use with with this block. I was trying to add a javascript to a block and all the input formats didn't work so I created a new input format and add no filters to this input format. This input format should work with javascript.
Creating new input format to allow javascript in a block
Go to Administer>Site Building. Choose "input formats." Create a title such as "allow javascript"
Now create a new block as usual and click the "Input format" to drop down the list. Choose your newly created input format. The rest is the same as usual.
Brilliant!
This worked for me, in Drupal 5.x. Thanks!
Finished products are for decadent minds. -- Isaac Asimov
Finished products are for decadent minds. -- Isaac Asimov
Thanks!
It worked for me too! Thanks a lot!
It doesnt work for me..
Hi Ragmop
I m using drupal 5.x but it doesnt work for me.
Can u tel me how to add below javascript code in block and abt input filter.
yes it works
yes it works now.......i can add javascript from new block.
Thanks :)
Small correction: in D6 it's
Small correction: in D6 it's Admin / Site configuration / Input formats
http://www.valthebald.net
http://www.valthebald.net
Thanks for this tip
New to Drupal. Considering switching sites from WP. Thanks for this great tip. Should make life so much easier. Happy to say I ran into this issue and solved it within minutes here. Awesome!
Javascript Block
I don't know how block support javascript, plz show me...
Same problem
I get same problem. Any one can help us? How to add block with javascript code?
What I did to solve the problem
I had this same issue a while ago and discovered that my script tags needed to look like this:
If I left out the type attribute or it was malformed, the javascript was not processed. This has to do with the xhtml doctype
http://www.bejoy.in/Techzone/Convert-html-to-xhtml
search for: "The type attribute is mandatory for all
tags. This value of type is text/javascript for Javascript."Generally one should be
Generally one should be adding JavaScript through one of the mechanisms provided by Drupal such as drupal_add_js or the 'script' section of a theme .info file
IS it a good practice?
I have used the javascript code inside a Block and chosen Input Text Format as "Full Html".
And the Javascript code is working fine.
But I want to know, whether its a good practice or not ?