How to add onload event to a div element

You can trigger some js automatically on an IMG element using onerror, and no src.

<img src onerror='alert()'>

No, you can't. The easiest way to make it work would be to put the function call directly after the element

Example:

...
<div id="somid">Some content</div>
<script type="text/javascript">
   oQuickReply.swap('somid');
</script>
...

or - even better - just in front of </body>:

...
<script type="text/javascript">
   oQuickReply.swap('somid');
</script>
</body>

...so it doesn't block the following content from loading.