いくつかのアドサーバーコードを遅延ロードしようとしています...
このページには、現時点でこれがあります。
<div class="ad">
<span>pos_1</span>
</div>
次に、ページに表示されるはずのすべての広告を調べて、それらのjavascriptインクルードファイルを呼び出すと、この素敵な混乱が発生します。
function do_ad(pos){
switch(pos){
case 'pos_1':
document.write('first ad text');
document.write('first ad more text');
//and so on for many many lines
break;
case 'pos_2':
document.write('second ad text');
document.write('second ad more text');
//and so on for many many lines
break;
}
}
document.write
次に、スパンを広告呼び出しの結果に置き換えたいと思います。
ページに書き込まれたはずの文字列を返すようにする方法はありますか?