SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Sep 2008
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    JS files not working as a external file !

    Hello experts
    I have an advertising script , its embedded on the html page . here is the code from the HTML

    Code:
    <script type='text/javascript'><!--//<![CDATA[
       var m3_u = (location.protocol=='https:'?'Linkhere':'Linkhere');
       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=40965&amp;target=_blank");
       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='Linkhere' target='_blank'><img src='Linkhere' border='0' alt='' /></a></noscript>
    Now i want to separate that JS code and make a file like add.js and then want to link that to the html file , here is the add.js file i wrote

    Code:
    <!--//<![CDATA[
       var m3_u = (location.protocol=='https:'?'Linkhere':'Linkhere');
       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=40965&amp;target=_blank");
       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>");//]]>-->
       
       document.write("<noscript><a href='Linkhere' target='_blank'><img src='Linkhere' border='0' alt='' /></a></noscript>");
    But the main problem is the ad is not showing up .
    Please help me


    thanks in advance .

  2. #2
    SitePoint Zealot
    Join Date
    Aug 2008
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i think this "<!--//<![CDATA[" is ok for HTML, but not for js
    try removing it


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •