See what Reddit uses to add one of its buttons:
<script type="text/javascript" src="http://www.reddit.com/button.js?t=2"></script>
This JavaScript adds an <iframe> to the page, then the <iframe> adds the HTML code.
Why doesn’t the JavaScript add the HTML directly?
To isolate the button’s markup and style from the web site’s own CSS rules.