2014-03-06 2 views
0

다음 HTML 코드를 사용하여 내 서버에서 광고를로드합니다. 인터넷에서 가져온 스타일을 사용 중이지만 아무 것도 작동하지 않습니다.자바 스크립트에서 가져온 센터 이미지 광고 내용

그것은 오른쪽에 표시됩니다, 그것은 반응해야하며 중앙에

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
    <html> 
    <head> 
    <style type="text/css"> 
    html, body { 
    width:100%; 
    height: 100%; 
    margin: 0px; 
    padding: 0px; 

// some code I got to center that content 
    max-width: 100%; 
    max-height: 100%; 
    margin: auto; 
    overflow: auto; 
    position: fixed; 
    margin-left: auto; margin-right: auto; 

    } 


    </style> 
    </head> 
    <body> 

<!-- this script loads the ad --> 
    <script type='text/javascript'> 
    var age = "23"; 
    var gender="male"; 
    //var location1="testifying"; 

     var m3_u = (location.protocol=='https:'?'https://openxtest.wfihotspotnet.in/delivery/ajs.php':'http://openxtest.wfihotspotnet.in/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=6"); 
     document.write ("&amp;TarGender="); 
     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> 

    </body> 
    </html> 

JS Fiddle Demo

은 뭐죠 미리 감사는

+0

, 인라인 CSS와 JS는 ['CDATA' 블록]에있을 필요가있을 것이다 (http://stackoverflow.com/questions/66837/when- is-a-cdata-section-needed-a-script-tag). 대신 HTML5가 XML이 아니기 때문에 HTML5 doctype''로 옮길 것을 제안 할 것입니다. 왜냐하면 HTML5는'CDATA' 블록을 필요로하지 않기 때문입니다. (그리고 XHTML은 본질적으로 죽어있다.) –

+0

@UselessCode 확실하게 해 드리겠습니다. 감사합니다. –

답변

2

은 그냥 함께 광고를 포장,이 코드에서 잘못 div, div 중심을 만듭니다. 당신은 XHTML의 문서 타입을 사용하는

.myad{ 
    width: 310px; 
    margin:0 auto; 
} 

http://jsfiddle.net/EzVEd/1/