Prototype Event.observe doesn't work in partial

Dear all

I encountered a problem to generate a zebra stripe table. My program is
no problem when the page is first load. But after the form_remote_tag
submitted, the prototype script could not addClassName to the new table
tr element. Any one know what is going wrong??

Furthermore, is it good practice for inline prototype script in

Thank you very much


<div id="event_list">
    <%= render :partial => 'event_list' %>

... code to generate the table ...
<script type="text/javascript" charset="utf-8">
    function stripe() {
        var evens = $$('table#event_table tr:nth-child(odd)');
        if(evens) {
            evens.each(function(tr) {
    // document.observe("dom:loaded", stripe)
    Event.observe(window, 'load', stripe, true);

    def index
        if request.xml_http_request?
            respond_to do |format|
                format.html {render :partial => "event_list"}

I suspect the Event.observe(window, 'load', stripe, true); is not
executed after an AJAX call, and you will have to call your stripe()
function explicitly.