Help with some code and calling JS file

Discussion in 'JavaScript' started by mattjack, Feb 12, 2008.

  1. #1
    I have been working on a advertising idea the last few weeks which i have finally got working, but only working in a standard html page. The issue i have is getting the code to work on one of my video sites that uses smarty templates!

    I think need to be able to call my code from a js file, but im not sure how to do it, as my code has bits that need to be in the body tag. Ive seen similar ideas ( which are installed on my site ) but not sure how these other companies make it work.

    Its basically a popover that appears in the bottom right hand corner of the screen. You can see a working one here on my video site ( NSFW )

    http://www.xxxmsncam.co.uk/media/2539/Sexy_Ipod_Girl_Does_Dance/
    Code (markup):
    Now the code is pulled using this script tag, from a php script on there site.
    Using this it overcomes any issues with putting code directly onto the site.

    <script charset="utf-8" src="http://xxxmsncam.sexy.sexy-datings.com/promo/script_alertwindow.php" type="text/javascript"></script>
    Code (markup):

    The code below is for my popover that i need to work in that way

    If someone can help me out here i am willing to pay them, as its been driving me nuts !!

    <HTML><HEAD>
    <script>
    var ie = document.all
    var dom = document.getElementById
    var ns4 = document.layers
    var direction = "up"
    var step = 15
    var poplayer
    
    function initbox() {
      if (!dom && !ie && !ns4) return
      poplayer = document.getElementById("dropin")
      poplayer.style.top = document.body.clientHeight
      poplayer.style.visibility = (dom || ie) ? "visible" : "show"
      dropstart = setInterval("dropin()", 50)
    }
    
    function dropin() {
      if (parseInt(poplayer.style.top) > document.body.clientHeight - 136 + step) {
        poplayer.style.top = parseInt(poplayer.style.top) - step
      } else {
        poplayer.style.top = document.body.clientHeight - 136
        clearInterval(dropstart)
      }
    }
    
    function dismissbox() {
      try {
        if (document.getElementById('dropframe')) {
          frames['dropframe'].location.href = 'about:blank';
        }
      } catch(e) {}
      if (window.bouncestart) clearInterval(bouncestart)
      poplayer.style.visibility = "hidden"
    }
    
    function StickyAd() {
      poplayer.style.right = ((ie) ? document.body.scrollLeft : window.pageXOffset +20)
      poplayer.style.top = ((ie) ? document.body.scrollTop : window.pageYOffset) + document.body.clientHeight - 136
    }
    
    function IPOLoad() {
      setTimeout('initbox()', 0)
      window.onscroll = StickyAd
    }
    </script>
    <!-- IPO CODE: ONLOAD END -->
    </HEAD><body onLoad="IPOLoad();">
    <!-- IPO CODE: DROPIN START -->
    <div id="dropin" style="position: absolute; visibility: hidden; left: auto; right: 20; width: 201; height: 136; border: 0px solid #8080C0; background-color: transparent">
      <div align=right>
        <font face=Tahoma size=1><a href='javascript:void(0);' onClick="dismissbox();return false"></a></font>&nbsp;&nbsp;
      </div>
      <a href="http://www.69livejasmin.com" target="_blank"><img src="http://www.xxxmsncam.co.uk/popup/msn.jpg" width="201" height="116" border="0" /></a>
    </div>
    <!-- IPO CODE: DROPIN END -->
    </BODY></HTML>
    
    Code (markup):
     
    mattjack, Feb 12, 2008 IP