Slight modification to Can's answer. As suggested,
update_page do |page|
page['image_id']['src'] = new_image_url
end
translates to JS:
$('image_id').src = new_image_url
This will work for some attributes that have direct JS DOM variable access, many don't. Luckily RJS is pretty good at rewriting JS method calls:
update_page do |page|
page['image_id'].set_attribute('attrib', new_attrib_val)
end
translates to JS:
$('image_id').setAttribute('attrib', new_attrib_val)
and you should be good to go.
Small update: you may want to use write_attribute instead if you want IE compatibility.
Small update: in the above, [:src] and :attrib would probably be better style if these are static.