amran mahanyu
amran mahanyu

Reputation: 5

Trying to input ads code in my website but there is error in this code can someone fix please

<script type="text/javascript">
    atOptions = {
        'key' : '4acc9ecf15520c3ad2d27837af408a5f',
        'format' : 'iframe',
        'height' : 50,
        'width' : 320,
        'params' : {}
    };
    document.write('<scr' + 'ipt type="text/javascript" src="http' + (location.protocol === 'https:' ? 's' : '') + '://www.effectivedisplayformats.com/4acc9ecf15520c3ad2d27837af408a5f/invoke.js"></scr' + 'ipt>');
</script>

Upvotes: -3

Views: 1052

Answers (1)

cup11
cup11

Reputation: 177

It's not a good idea for you to use document.write in inline JavaScript (especially those in <body>) because it'll overwrite the <script> itself. Perhaps you can create an element and change its innerHTML, or you can put it into <head> and use <body onload>.

Upvotes: 1

Related Questions