O'Reilly logo

Drupal 6 Theming Cookbook by Karthik Kumar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 7. JavaScript in Themes

We will be covering the following recipes in this chapter:

  • Including JavaScript files from a theme
  • Including a JavaScript file only for certain pages
  • Giving the username textfield keyboard focus
  • Exporting a variable from PHP to JavaScript
  • Adding default text to the search textfield
  • Displaying comments in compact form
  • Adding column-sort functionality to tables
  • Minimizing and maximizing blocks using JavaScript

Introduction

Until a few years ago, mentioning the word JavaScript to a themer would usually result in groans about inconsistencies in browser support, lack of standards, difficulty in debugging, and a myriad of other complaints. Thankfully, however, things have changed considerably since then. Browsers have evolved and ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required