2013-12-16 5 views
1

openx로 만든 배너를로드하고 싶습니다. 그러나 배너 코드에는 iframe이 없을 때 페이지를 지우는 document.write 명령이 들어 있습니다. (document.write clears page)ajax를 통해 openx 배너로드하기

<!--/* OpenX Javascript Tag v2.8.8 */-->  
<script type='text/javascript'> 
<!--//<![CDATA[  
var m3_u = (location.protocol=='https:'?'https://www.aw04.net/ads/www/delivery/ajs.php':'http://www.aw04.net/ads/www/delivery/ajs.php');  
var m3_r = Math.floor(Math.random()*99999999999);  if (!document.MAX_used) document.MAX_used = ',';  
document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);  
document.write ("?zoneid=299");  
document.write ('&amp;cb=' + m3_r);  
if (document.MAX_used != ',') document.write ("&amp;exclude=" + document.MAX_used);  
document.write (document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));  
document.write ("&amp;loc=" + escape(window.location));  
if (document.referrer) document.write ("&amp;referer=" + escape(document.referrer));  
if (document.context) document.write ("&context=" + escape(document.context));  
if (document.mmm_fo) document.write ("&amp;mmm_fo=1");  
document.write ("'><\/scr"+"ipt>"); *///]]>--> 
</script> 
<noscript> 
<a href='http://www.aw04.net/ads/www/delivery/ck.php?n=a47d7715&amp;cb=INSERT_RANDOM_NUMBER_HERE' target='_blank'> 
<img src='http://www.aw04.net/ads/www/delivery/avw.php?zoneid=299&amp;cb=INSERT_RANDOM_NUMBER_HERE&amp;n=a47d7715' border='0' alt='' /> 
</a></noscript> 

로딩이 스크립트의 방법이있는 것이 아닙니다은 iframe에 수정되지 않은 있습니까 : 내 배너 확장 할 수 있기 때문에, 나는 사업부 여기

배너의 코드입니다에로드 싶어?

답변

0

를 들어, JSON으로 반환 나는 다음과 같은 코드로 document.write를 덮어 수 있습니다 : 지금은 단지에있는

var elementToWrite = null; 

document.write = function() { 
    if (elementToWrite != null) { 
     elementToWrite.append([].concat.apply([], arguments).join('')); 
    } 
}; 

을 elementToWrite 변수를 jQuery의 일부 요소로 설정하면 실제로 몇 가지 문제가 있지만 응용 프로그램 코드에서 수정할 수있는 것은 없습니다.

0

당신이 필요로하는 것은 링크 2 개 (<image src=""에 대한 링크 및 <a href="" 속성에 대한 링크)입니다.

그래서 당신은 당신의 백 엔드 서버에 그것을 얻을 예를