With jQuery loadAdScript you can load third party ad network scripts that use document.write into specific containers. The only downside is that the ads will load serially.. but that's necessary to keep them from stepping on each others' toes. And the upside is that your site isn't completely borked!

Requires the jQuery Message Queueing plugin.

Sample ads

In this example, the ads are hidden by default, and are only shown when their ad script has finished executing.

The code

01.$(function(){
02.   
03.  // a.js simply calls document.write a few times. It's not great, but it's not
04.  // the end of the world.
05.  $('#a').loadAdScript( 'a.js', function(){
06.    $(this).show(); // When the ad script has loaded, show the ad.
07.  });
08.   
09.  // b.js calls document.write and loads another external script that also calls
10.  // document.write. It's starting to get ugly, but that's what third party ad
11.  // networks are all about!
12.  $('#b').loadAdScript( 'b.js', function(){
13.    $(this).show(); // When the ad script has loaded, show the ad.
14.  });
15.   
16.  // c.js calls document.write and loads multiple other external scripts that
17.  // also call document.write and load other external scripts. Look out, because
18.  // there's a "web 1.0 document write" party in your page, and everyone's invited!
19.  $('#c').loadAdScript( 'c.js', function(){
20.    $(this).show(); // When the ad script has loaded, show the ad.
21.  });
22.   
23.});