I want to create so called "widgets", that is page elements other webmasters put on their websites.

Actually, I created a few, but all of them based on iframe. But, when I look at widgets created by others, they don't do that. An example would be adsense code.

Usually this looks like this:

<script src="http://..../someExternalScript"></script>
So I have a few questions:
1. What's wrong with using iframe's? It's simple to add and create.
2. In this external script, should I use "document.write" or is there another method?
3. In this external script, writing "document.write ('here goes the code of the widget')" all the time is quite uneffective, is there a method to simply write the code and then somehow convert it to "document.write (...)" ?