#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    456
    Rep Power
    15

    delimiting javascript


    I am trying to use my ad network's javascript code to serve those long and thin skyscraper banners. They are displayed on the right side of my layout, which is about 800 pixels wide. This caused an annoying horizontal scoll for users with resolutions that are less than 1024 pixels wide. In order to eliminate this, I wrote a javascript that displays the skyscraper banners only to users with screens at least 1024 wide. I was using document.write to write in an IFRAME that contained the javascript for the banner, but the are cache problems with the IFRAME.

    This has made it necessary for me to have the javascript write the javascript for the banner. I am having all sorts of problems with this. I first tried to use a <script source="banner.js">, but no luck because of syntax errors, even though the contents of banner.js pasted into an HTML worked fine.

    I think my only solution would be to break my javascript (pasted below) down line by line, delimit each line, and then use document.write over and over to write all of the lines.

    Is that the best approach? Any other ideas? Can someone give me some pointers on how to delimit in javascript, or maybe point me to a program that can do it automatically?

    THANKS!


    Code:
    <!-- FASTCLICK.COM 120x600 v1.4 for allgamesfree.com -->
    <script language="Javascript"><!--
    var i=j=p=t=u=x=z=dc='';var id=f=0;var f=Math.floor(Math.random()*7777);
    id=1182; dc=document;u='ht'+'tp://media.fastclick.net/w'; x='/get.media?t=n';
    z=' width=120 height=600 border=0 ';t=z+'marginheight=0 marginwidth=';
    i=u+x+'&sid='+id+'&m=3&f=b&v=1.4&c='+f+'&r='+escape(dc.referrer);
    u='<a  hr'+'ef="'+u+'/click.here?sid='+id+'&m=3&c='+f+'"  target="_blank">';
    dc.writeln('<ifr'+'ame src="'+i+'&d=f"'+t+'0 hspace=0 vspace=0 frameborder=0 scrolling=no>');
    if(navigator.appName.indexOf('Mic')<=0){dc.writeln(u+'<img src="'+i+'&d=n"'+z+'></a>');}
    dc.writeln('</iframe>'); // --></script><noscript>
    <a href="http://media.fastclick.net/w/click.here?sid=1182&m=3&c=1"  target="_blank">
    <img src="http://media.fastclick.net/w/get.media?sid=1182&m=3&d=s&c=1&f=b&v=1.4"
    width=120 height=600 border=1></a></noscript>
    <!-- FASTCLICK.COM 120x600 v1.4 for allgamesfree.com -->
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    Pune, India
    Posts
    31
    Rep Power
    12
    As u r saying that u get script error when u used <script source="banner.js">. What i understand is that u didn't removed the script tag from the code that u wrote in that file. Try again this time don;t write <script language="Javascript"> and closing script tag in file. Start from var i=j=p...
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    Pune, India
    Posts
    31
    Rep Power
    12
    And i think u will also have to remove opeing and closing <noscript>tags.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    456
    Rep Power
    15
    Thanks, I managed to find a solution.

IMN logo majestic logo threadwatch logo seochat tools logo