Weston Ruter wrote about Google AdSense and Google's AJAX APIs issue —”that google.load() function uses document.write() to output the necessary script elements to the DOM, which doesn't even appear to be necessary since google.setOnLoadCallback() executes after the scripts are loaded without using document.write() (but instead appended document with DOM methods). And the reason why using document.write() is bad, of course, is that it is not available when in XHTML.”
Likewise, Google's AdSense program provides a great way for web authors to make get some compensation for their hard work. But it too relies on document.write() to output the necessary iframe element to display the advertisement. In the past John Resig wrote a little wrapper to make document.write to DOM work instead.