<script type='text/ruby'> window.onload do introduction = document.create_element('p') introduction.inner_text = 'Hello, world!' document.body.append_child(introduction) end </script>
It only works on the Mac right now, and there are a few other gotcha's to keep in mind:
- In Ruby, methods and attributes are specified in
windowvariable is accessible from only the top-most scope. Elsewhere you can use the global
- Ruby accepts
blocksas callbacks and listeners. View an example.