Announcement

Collapse
No announcement yet.

Any idea why this code doesn't work?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [Forum] Any idea why this code doesn't work?

    I have code here for a rotating banner and when I place it in my header template it does not work, by not work I mean that it's just a blank space with a link that says "your alt text" Click image for larger version

Name:	headertemp.png
Views:	1
Size:	88.7 KB
ID:	3724743

    the banner that I'm using is a 3 piece banner as you can see in the rotating banner code, and I'm trying to put the banner above the admin, settings, log out links. here's what my site normally looks like http://anime-forum.net

    I'll show you the code I'm trying to use and the code once it's in my header template...

    rotating banner code
    Code:
    <script language="javascript" type="text/javascript" src="/templates/high_javascript.js">
    <!--
    //var iWidth = 0;
    //var iHeight = 0;
    
    //-->
    </script>
    
    
    
     <center>
    
    <script type="text/Javascript">
    <!--
    /*initialization for IE! Leave this funtion after the body tag */
     /*if(!window.Width && document.body && document.body.offsetWidth)
      {
       //window.onresize = recal;
          //alert("line114!");
       Width = windowWidth();
       Height = windowHeight();
       //alert(Width + "<br>" + Height);
       //alert("width");
     }
     */
    //-->
    var iWidth, iHeight, sRes;
    if (window.innerWidth != null) {
        //alert("first");
        iWidth = window.innerWidth;
        iHeight = window.innerHeight; 
    }
    else if (document.body.clientWidth != null) {
        //alert("second");
        iWidth = document.body.clientWidth;
        iHeight=document.body.clientHeight;
    } else {
        //alert("third");
        }
    
    
    
    images_M = new Array(3);
    
    if (iWidth <= 1100)     
    {
    
        images_M[0] = "<a href = http://www.yoursite.com target=_new><img src='' alt='Your alt text' width='350'></a>";
    
        images_M[1] = "<a href = http://www.yoursite.com target=_new><img src='' alt='Your alt text' width='350'></a>";
    
        images_M[2] = "<a href = http://www.anime-forum.net target=_new><img src='images/ban_01.gif' alt='Your alt text'></a><a href = http://www.anime-forum.net target=_new><img src='images/ban_02.gif' alt='Your alt text'></a><a href = http://www.anime-forum.net target=_new><img src='images/ban_03.gif' alt='Your alt text'></a>";
    
        index_M = Math.floor(Math.random() * images_M.length);
    
        document.write(images_M[index_M]);
    
      }
    else
       {
    
    
        images_M[0] = "<a href = http://www.yoursite.com target=_new><img src='' alt='Your alt text' width='430'></a>";
    
        images_M[1] = "<a href = http://www.yoursite.com target=_new><img src='' alt='Your alt text' width='430'></a>";
    
        images_M[2] = "<a href = http://www.anime-forum.net target=_new><img src='images/ban_01.gif' alt='Your alt text'></a><a href = http://www.anime-forum.net target=_new><img src='images/ban_02.gif' alt='Your alt text'></a><a href = http://www.anime-forum.net target=_new><img src='images/ban_03.gif' alt='Your alt text'></a>";
    
        index_M = Math.floor(Math.random() * images_M.length);
        
        document.write(images_M[index_M]);
        
    
    }
    </script>
    </center>
    my header template
    Code:
    <script language="javascript" type="text/javascript" src="/templates/high_javascript.js">
    <!--
    //var iWidth = 0;
    //var iHeight = 0;
    
    //-->
    </script>
    
    
    
     <center>
    
    <script type="text/Javascript">
    <!--
    /*initialization for IE! Leave this funtion after the body tag */
     /*if(!window.Width && document.body && document.body.offsetWidth)
      {
       //window.onresize = recal;
          //alert("line114!");
       Width = windowWidth();
       Height = windowHeight();
       //alert(Width + "<br>" + Height);
       //alert("width");
     }
     */
    //-->
    var iWidth, iHeight, sRes;
    if (window.innerWidth != null) {
        //alert("first");
        iWidth = window.innerWidth;
        iHeight = window.innerHeight; 
    }
    else if (document.body.clientWidth != null) {
        //alert("second");
        iWidth = document.body.clientWidth;
        iHeight=document.body.clientHeight;
    } else {
        //alert("third");
        }
    
    
    
    images_M = new Array(3);
    
    if (iWidth <= 1100)     
    {
    
        images_M[0] = "<a href = http://www.yoursite.com target=_new><img src='' alt='Your alt text' width='350'></a>";
    
        images_M[1] = "<a href = http://www.yoursite.com target=_new><img src='' alt='Your alt text' width='350'></a>";
    
        images_M[2] = "<a href = http://www.anime-forum.net target=_new><img src='images/ban_01.gif' alt='Your alt text'></a><a href = http://www.anime-forum.net target=_new><img src='images/ban_02.gif' alt='Your alt text'></a><a href = http://www.anime-forum.net target=_new><img src='images/ban_03.gif' alt='Your alt text'></a>";
    
        index_M = Math.floor(Math.random() * images_M.length);
    
        document.write(images_M[index_M]);
    
      }
    else
       {
    
    
        images_M[0] = "<a href = http://www.yoursite.com target=_new><img src='' alt='Your alt text' width='430'></a>";
    
        images_M[1] = "<a href = http://www.yoursite.com target=_new><img src='' alt='Your alt text' width='430'></a>";
    
        images_M[2] = "<a href = http://www.anime-forum.net target=_new><img src='images/ban_01.gif' alt='Your alt text'></a><a href = http://www.anime-forum.net target=_new><img src='images/ban_02.gif' alt='Your alt text'></a><a href = http://www.anime-forum.net target=_new><img src='images/ban_03.gif' alt='Your alt text'></a>";
    
        index_M = Math.floor(Math.random() * images_M.length);
        
        document.write(images_M[index_M]);
        
    
    }
    </script>
    </center>
      
    
    </div>
    
    </div>
    
    <div class="above_body"> <!-- closing tag is in template navbar -->
    <div id="header" class="floatcontainer doc_header">
    
    <vb:if condition="$stylevar['titleimage']"><div><a name="top" href="{vb:link forumhome}" class="logo-image"><img src="" alt="" /></a></div></vb:if>
    
        <div id="toplinks" class="toplinks">
    thanks

  • #2
    I'm just taking a stab at this, but the first thing I would do is to change this;

    Code:
    images_M[0] = "<a href = http://www.yoursite.com target=_new><img src='' alt='Your alt text' width='350'></a>";    
    images_M[1] = "<a href = http://www.yoursite.com target=_new><img src='' alt='Your alt text' width='350'></a>";    
    images_M[2] = "<a href = http://www.anime-forum.net target=_new><img src='images/ban_01.gif' alt='Your alt text'></a><a href = http://www.anime-forum.net target=_new><img src='images/ban_02.gif' alt='Your alt text'></a><a href = http://www.anime-forum.net target=_new><img src='images/ban_03.gif' alt='Your alt text'></a>";
    to this;

    Code:
    images_M[0] = "<a href=http://www.anime-forum.net target=_new><img src='images/ban_01.gif' alt='Your alt text'></a>";
    images_M[1] = "<a href=http://www.anime-forum.net target=_new><img src='images/ban_02.gif' alt='Your alt text'></a>";
    images_M[2] = "<a href=http://www.anime-forum.net target=_new><img src='images/ban_03.gif' alt='Your alt text'></a>";
    I hope this helps.

    Comment

    widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
    Working...
    X