Widget code is not working on WordPress.com Hosted Blogs

WordPress.com does not allow you to post javascript.

From WordPress.com Support:

Users are not allowed to post JavaScript on WordPress.com blogs. JavaScript can be used for malicious purposes. As an example, JavaScript has taken down sites such as MySpace.com and LiveJournal offline in the past. The security of all the blogs is a top priority and until we can guarantee scripting languages will not be harmful they will not be permitted.

JavaScript from trusted partners, such as YouTube and Google Video, is converted into a WordPress shortcode when a post is saved.