Cross browser issues with utility functions in Prototype

May 7th, 2009

When using utility functions in Prototype library (e.g., F$), the element name must be surrounded by quotes. Firefox requires it to not include quotes, but IE does not.

This example does not work:

$F(sample);  //DOES NOT WORK!!

This example does work:

$F(‘sample’);  //DOES WORK!

This was tested with Firefox 3 and IE7 using Prototype 1.5.1.

Mix JSTL and JavaScript to build a select list

April 30th, 2009

This article describes how to build a list of

Use Prototype to select all elements by class

April 22nd, 2009

Prototype has a number of handy utility methods. One of my favorites is the “$$” method, which allows you to select elements by class name. As with most other Prototype functions, this one can be chained to do some really cool stuff.
Read the rest of this entry »

Using Google JSON with Prototype and Java

April 10th, 2009

Widely hailed as the successor to XML in the browser, JSON aspires to be nothing more than a simple and elegant data format for the exchange of information between the browser and server. In this example we will learn how to create a JSON object on the client using JavaScript (and Prototype), and how to process that same JSON object on the server using Java. The examples use the Google JSON (or GSON) libraries for the JSON parsing.
Read the rest of this entry »

Cross-browser event handler using Prototype

April 5th, 2009

Event handling in JavaScript is a great thing. Unfortunately, there are some cross-browser issues with event handling (IE rant omitted). Once again, Prototype comes to the rescue. Read the rest of this entry »

Filter a dropdown list using JavaScript and Prototype

March 25th, 2009

This article describes a technique that takes input from a text field and populates a dropdown list that matches the input text. This is similar to the “auto-complete” feature that is commonly used for search fields.
Read the rest of this entry »

Mixing JSP scriptlet code and JavaScript

March 14th, 2009

It’s easy to mix Java scriptlet (JSP) code and JavaScript code. Here’s how you can embed scriptlet code in your JavaScript code, using a simple example of setting a JavaScript variable: Read the rest of this entry »

Mixing JSTL and JavaScript

February 28th, 2009

There are some quirks to keep in mind when mixing JSTL with JavaScript code. Here’s how you can use JSTL to produce JavaScript code: Read the rest of this entry »