Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jan 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Array based css replace script failing

    I've been running into some trouble with a script that just isn't working, and since I'm not encountering any error messages and a similar script on the same page is working just fine, I'm really puzzled.
    Anyways, here's the code I'm having trouble with:
    Code:
    function ShowHide(Numb){
    Ident1 = AdIDList[Numb]+"Tx";
    Ident2 = AdIDList[Numb]+"Lnk";
    if (AdLink[Numb] == "hidden"){
    	document.getElementById(Ident1).style.height = "355px";
    	AdLink[Numb] = "visible";
    }
    if (AdLink[Numb] =="visible"){
    	document.getElementById(Ident1).style.height = "55px";
    	AdLink[Numb] = "hidden";
    }
    }
    And here's the page code calling it (The page is assembled via PHP from a database, but I'm grabbing the code from my browser)
    Code:
     <a href="#Good ShepherdLnk" id="Good ShepherdLnk" onclick="ShowHide(2);return false;" class="AdLink">Stories</a><br>
    And, here's a similar bit of code on the same page that is working just as it's supposed to.
    Code:
     function hideimage(){
    for (Count=0; Count<AdTotal; Count ++){
    	if (VisPic[Count]=="visible"){
    		Ident = AdIDList[Count]+"AdB";
    		document.getElementById(Ident).style.visibility = "hidden";
    		VisPic[Count]="hidden";
    		}
    }
    }
    
    function bigimage(Item){
    hideimage();
    Ident1 = AdIDList[Item]+"AdB";
    document.getElementById(Ident1).style.left="35%";
    document.getElementById(Ident1).style.visibility = "visible";
    VisPic[Item] = "visible";
    }

  • #2
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,396
    Thanks
    12
    Thanked 569 Times in 562 Posts
    What does AdLink[] contain initially?

  • #3
    New to the CF scene
    Join Date
    Jan 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by devnull69 View Post
    What does AdLink[] contain initially?
    "hidden", it's part of a page setup code:

    Code:
    	for (Count=0; Count < AdTotal ; Count ++){
    		Class=AdSize[Count];
    		AdPicH[Count] = (PaperW*AdHeight[Count]*ClassProp[Class]);
    		AdPicW[Count] = (PaperW*AdWidth[Count]*ClassProp[Class]);
    	Ident2 = AdIDList[Count]+"Ad";
    	document.getElementById(Ident2).style.height = AdPicH[Count]+"px";
    	document.getElementById(Ident2).style.width = AdPicW[Count]+"px";
    	VisPic[Count] = "hidden";
    	AdLink[Count] = "hidden";
    }
    }


  •  

    Posting Permissions

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