Announcement

Collapse
No announcement yet.

Javascript in Sidebar Doesnt Display

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

  • [Forum] Javascript in Sidebar Doesnt Display

    I have some ads displayed on the right sidebar. I am trying to use the block to display it. But its not showing JavaScript ads. I have edited the header template to put the similar code there, which worked fine.



    Please suggest.

  • #3
    Here is the code:

    Code:
    <script type="text/javascript">
    Vertical1243618 = false;
    ShowAdHereBanner1243618 = true;
    RepeatAll1243618 = false;
    NoFollowAll1243618 = false;
    BannerStyles1243618 = new Array(
        "a{display:block;font-size:11px;color:#888;font-family:verdana,sans-serif;margin:0 4px 10px 0;text-align:center;text-decoration:none;overflow:hidden;}",
        "img{border:0;clear:right;}",
        "a.adhere{color:#666;font-weight:bold;font-size:12px;border:1px solid #ccc;background:#e7e7e7;text-align:center;}",
        "a.adhere:hover{border:1px solid #999;background:#ddd;color:#333;}"
    );
    document.write(unescape("%3Cscript src='"+document.location.protocol+"//s3.buysellads.com/1243618/1243618.js?v="+Date.parse(new Date())+"' type='text/javascript'%3E%3C/script%3E"));
    </script>

    Comment


    • #4
      I've just added that code into a 'Custom HTML/PHP' block and got an ad displayed OK (other than not fitting into the block!).

      What are the settings you're using for that block?
      Vote for:

      - *Admin Settable Paid Subscription Reminder Timeframe*
      -
      *PM - Add ability to reply to originator only*
      - Add Admin ability to auto-subscribe users to specific channel(s)
      - Highlight the correct navigation tab when you are on a custom page
      - "Quick Route" Interface...
      - Allow to use custom icons for individual forums

      Comment


      • #5
        I just tested again, its working.
        I tried with HTML and PHP both yesterday. It wasnt working yesterday; could be caching or something else was the reason. Glad its sorted though.

        Thanks for the help.

        Comment


        • #6
          a lot of the the time i am finding many common problems are fixed by clearing your cache both browser cache and also the CMS cache (for some reason this seems to help)

          Comment


          • #7
            I am having the same problem.

            I have javascript code for banners in the header and footer of the forum, plus in the first and last post of threads. The code is the same for all these different zones (apart from the zone name) so should work the same in each area... however all the ads show fine in Firefox, but in Chrome and IE8 the top banner does not show.

            There's no reason I can see why this is the case.

            The javascript code in the ad block is as follows :

            Code:
            <script language="javascript">
            	top = new Banner('top');
            	top.add("IMAGE", "banner-rotator/banners/banner1.gif", 30, 60, 468,"http://www.domain1.com","_blank");
            	top.add("IMAGE", "banner-rotator/banners/banner2.gif", 30, 60, 468,"http://www.domain2.com","_blank");
            	top.add("FLASH", "banner-rotator/banners/banner3.swf", 30, 60, 468,"http://www.domain3.net","_blank");
            	top.add("IMAGE", "banner-rotator/banners/banner4.gif", 30, 60, 468,"http://www.domain4.com","_blank");
            	top.add("IMAGE", "banner-rotator/banners/banner5.gif", 30, 60, 468,"http://www.domain5.biz","_blank");
            	top.add("FLASH", "banner-rotator/banners/banner6.swf", 30, 60, 468,"http://www.domain6.com","_blank");
            	document.write(top);
            	top.start();
            </script>
            The additional mBanner.js that is included too, is as follows :

            Code:
            // BANNER OBJECT
            function Banner(objName){
            	this.obj = objName;
            	this.aNodes = [];
            	this.currentBanner = 0;
            	this.changeOnRefresh = false;
            	
            };
            
            // ADD NEW BANNER
            Banner.prototype.add = function(bannerType, bannerPath, bannerDuration, height, width, hyperlink, target) {
            	this.aNodes[this.aNodes.length] = new Node(this.obj +"_"+ this.aNodes.length, bannerType, bannerPath, bannerDuration, height, width, hyperlink, target);
            };
            
            // Node object
            function Node(name, bannerType, bannerPath, bannerDuration, height, width, hyperlink, target) {
            	this.name = name;
            	this.bannerType = bannerType;
            	this.bannerPath = bannerPath;
            	this.bannerDuration = bannerDuration;
            	this.height = height
            	this.width = width;
            	this.hyperlink= hyperlink;
            	this.target= target;
            };
            
            // Outputs the banner to the page
            Banner.prototype.toString = function() {
            	var str = "";
            	var iBannerIndex = 0;
            	if(this.changeOnRefresh == true){
            		// Read the cookie
            		var BannerName = this.obj;
            		var lastBannerIndex = readCookie(BannerName);
            
            		if(isNaN(lastBannerIndex) == true || lastBannerIndex == null){
            			iBannerIndex = 0;
            		}else if(lastBannerIndex == '' || parseInt(lastBannerIndex) >= this.aNodes.length - 1){
            			iBannerIndex = 0;
            		}else{
            			iBannerIndex = parseInt(lastBannerIndex) + 1;
            		}
            	
            		// Set the new value
            		createCookie(BannerName,iBannerIndex,7);
            	}
            
            	for (var iCtr=0; iCtr < this.aNodes.length; iCtr++){
            		if(this.changeOnRefresh == true && iBannerIndex != iCtr){
            			continue;
            		}
            		str = str + '<span name="'+this.aNodes[iCtr].name+'" '
            		str = str + 'id="'+this.aNodes[iCtr].name+'" ';
            		if(this.changeOnRefresh == true && iBannerIndex == iCtr){
            			str = str + 'class="m_banner_show" ';
            		}else{
            			str = str + 'class="m_banner_hide" ';
            		}
            		str = str + 'bgcolor="#FFFCDA" ';	// CHANGE BANNER COLOR HERE
            		str = str + 'align="center" ';
            		str = str + 'valign="top" >\n';
            			
            		if ( this.aNodes[iCtr].bannerType == "FLASH" ){
            			str = str + '<OBJECT ';
            			str = str + 'classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
            			str = str + 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ';
            			str = str + 'WIDTH="'+this.aNodes[iCtr].width+'" ';
            			str = str + 'HEIGHT="'+this.aNodes[iCtr].height+'" ';
            			str = str + 'id="bnr_'+this.aNodes[iCtr].name+'" ';
            			str = str + 'ALIGN="" ';
            			str = str + 'VIEWASTEXT>';
            			str = str + '<PARAM NAME=movie VALUE="'+ this.aNodes[iCtr].bannerPath + '">';
            			str = str + '<PARAM NAME=quality VALUE=high>';
            			str = str + '<PARAM NAME=bgcolor VALUE=#FFFCDA>';
            			if (this.aNodes[iCtr].hyperlink != ""){
            				str = str + '<PARAM NAME=flashvars VALUE="clickTag='+this.aNodes[iCtr].hyperlink;
            				if(this.aNodes[iCtr].target != ""){
            					str = str + '&clickTarget='+this.aNodes[iCtr].target;
            				}
            				str = str + '" />';
            			}
            			str = str + '<EMBED ';
            			str = str + 'src="'+this.aNodes[iCtr].bannerPath+'" ';
            			str = str + 'quality=high ';
            //			str = str + 'bgcolor=#FFFCDA ';
            			str = str + 'WIDTH="'+this.aNodes[iCtr].width+'" ';
            			str = str + 'HEIGHT="'+this.aNodes[iCtr].height+'" ';
            			str = str + 'NAME="bnr_'+this.aNodes[iCtr].name+'" ';
            			str = str + 'ALIGN="center" ';
            			str = str + 'TYPE="application/x-shockwave-flash" ';
            			str = str + 'PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" ';
            			if (this.aNodes[iCtr].hyperlink != ""){
            				str = str + 'FLASHVARS="clickTag='+this.aNodes[iCtr].hyperlink;
            				if(this.aNodes[iCtr].target != ""){
            					str = str + '&clickTarget='+this.aNodes[iCtr].target;
            				}
            				str = str + '" ';
            			}
            			
            			str = str + '>';
            			str = str + '</EMBED>'
            			str = str + '</OBJECT>'
            		}else if ( this.aNodes[iCtr].bannerType == "IMAGE" ){
            			if (this.aNodes[iCtr].hyperlink != ""){
            				str = str + '<a href="'+this.aNodes[iCtr].hyperlink+'" '
            				if(this.aNodes[iCtr].target != ""){
            					str = str + ' target="' + this.aNodes[iCtr].target + '" ';
            				}
            				str = str + '>';
            			}
            			str = str + '<img src="'+this.aNodes[iCtr].bannerPath+'" ';
            			str = str + 'border="0" ';
            			str = str + 'height="'+this.aNodes[iCtr].height+'" ';
            			str = str + 'width="'+this.aNodes[iCtr].width+'">';
            			if (this.aNodes[iCtr].hyperlink != ""){
            				str = str + '</a>';
            			}
            		}
            
            
            		str += '</span>';
            
            
            	}
            	return str;
            };
            
            // START THE BANNER ROTATION
            Banner.prototype.start = function(){
            	if(this.changeOnRefresh == false){
            		this.changeBanner();
            		var thisBannerObj = this.obj;
            		// CURRENT BANNER IS ALREADY INCREMENTED IN cahngeBanner() FUNCTION
            		setTimeout(thisBannerObj+".start()", this.aNodes[this.currentBanner].bannerDuration * 1000);
            	}
            }
            
            // CHANGE BANNER
            Banner.prototype.changeBanner = function(){
            	var thisBanner;
            	var prevBanner = -1;
            	if (this.currentBanner < this.aNodes.length ){
            		thisBanner = this.currentBanner;
            		if (this.aNodes.length > 1){
            			if ( thisBanner > 0 ){
            				prevBanner = thisBanner - 1;
            			}else{
            				prevBanner = this.aNodes.length-1;
            			}
            		}
            		if (this.currentBanner < this.aNodes.length - 1){
            			this.currentBanner = this.currentBanner + 1;
            		}else{
            			this.currentBanner = 0;
            		}
            	}
            	
            
            	if (prevBanner >= 0){
            		document.getElementById(this.aNodes[prevBanner].name).className = "m_banner_hide";
            	}
            	document.getElementById(this.aNodes[thisBanner].name).className = "m_banner_show";
            }
            
            // Following Cookie Code taken from http://www.quirksmode.org
            function createCookie(name,value,days) {
            	if (days) {
            		var date = new Date();
            		date.setTime(date.getTime()+(days*24*60*60*1000));
            		var expires = "; expires="+date.toGMTString();
            	}
            	else var expires = "";
            	document.cookie = name+"="+value+expires+"; path=/";
            }
            
            function readCookie(name) {
            	var nameEQ = name + "=";
            	var ca = document.cookie.split(';');
            	for(var i=0;i < ca.length;i++) {
            		var c = ca[i];
            		while (c.charAt(0)==' ') c = c.substring(1,c.length);
            		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
            	}
            	return null;
            }
            I have tried clearing the cache and cookies in both browsers, but this has not made a difference.

            Any help greatly appreciated!

            Comment


            • #8
              That's not actually the same problem as you're not having this in a Forum Block. Please start your own thread for this with details of what templates you've edited to add this code and where in the templates.
              Vote for:

              - *Admin Settable Paid Subscription Reminder Timeframe*
              -
              *PM - Add ability to reply to originator only*
              - Add Admin ability to auto-subscribe users to specific channel(s)
              - Highlight the correct navigation tab when you are on a custom page
              - "Quick Route" Interface...
              - Allow to use custom icons for individual forums

              Comment


              • #9
                I ahven't editied any templates... I pasted the code in an ad block.

                Comment

                Related Topics

                Collapse

                Working...
                X