How to use flash in javascript?

The following code can not run:

This is a test

How to combine the <%= %> pairs with the javascript code?

pinnacle wrote:

The following code can not run:

This is a test
function foo(id) { Element.hide($(id)); <% for name in [:notice, :warning, :message] %> <% if flash[:notice] %>

Is that a typo, or do you mean flash[name]?