Adding a CSS, JS and HTML code to a block Using Drupal 7.2 I've successfully added a Google Adsense banner to my website by creating a new block with admin/structure/block/add and puting Google's code as "raw HTML" (added that "raw HTML" format first in admin/config/content/formats/add) there:

&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client = "XXX";
/* block1 */
google_ad_slot = "YYY";
google_ad_width = 160;
google_ad_height = 600;
//--&gt;
&lt;/script&gt;
&lt;script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;


Now I'm trying to add another block containg a Like-button by the russian social network Odnoklassniki.ru:



My problem is - they want me to add:

Head:

&lt;link href="http://stg.odnoklassniki.ru/share/odkl_share.css" rel="stylesheet"&gt;
&lt;script src="http://stg.odnoklassniki.ru/share/odkl_share.js" type="text/javascript"&gt;&lt;/script&gt;

&lt;style type="text/css"&gt;
.odkl-klass, .odkl-klass:hover {background:none;}
.odkl-klass {background: url(/images/128x128.png) no-repeat;}
&lt;/style&gt;


Body:

&lt;a class="odkl-klass-stat" href="http://preferans.de" onclick="ODKL.Share(this); return false;"&gt;&lt;span&gt;0&lt;/span&gt;&lt;/a&gt;


And call:

&lt;body onload="ODKL.init();"&gt;


How could I do it the best way please? (it would be good not to have it updated every time I update the Drupal version)

When I just try to put all 3 pieces listed above into a block (as I did for Google banner) - the button doesn't work.
The link and the script can be added through drupal_set_html_head() head

drupal_set_html_head('&lt;link href="http://stg.odnoklassniki.ru/share/odkl_share.css" rel="stylesheet"&gt;&lt;script src="http://stg.odnoklassniki.ru/share/odkl_share.js" type="text/javascript" &gt;&lt;/script&gt;');


On clicks are not good practice in drupal. Behaviors are used in stead. 

So in your block you can output 

  &lt;a class="odkl-klass-stat" href="http://preferans.de"&gt;&lt;span&gt;0&lt;/span&gt;&lt;/a&gt;


You can then set a couple of behaviors in your own script, which you can put in a file and add using drupal_add_js()

 Drupal.behaviors.my_module = function (context) {
   // This will load on page load
   ODKL.init();
   // This will attach a click handler to the links
   $('.odkl-klass-stat').click(function() {
   ODKL.Share(this);
   return false;
   }); 
 };