View Full Version : Array based css replace script failing

01-26-2012, 04:57 PM
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:

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)

<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.

function hideimage(){
for (Count=0; Count<AdTotal; Count ++){
if (VisPic[Count]=="visible"){
Ident = AdIDList[Count]+"AdB";
document.getElementById(Ident).style.visibility = "hidden";

function bigimage(Item){
Ident1 = AdIDList[Item]+"AdB";
document.getElementById(Ident1).style.visibility = "visible";
VisPic[Item] = "visible";

01-26-2012, 05:30 PM
What does AdLink[] contain initially?

01-26-2012, 05:37 PM
What does AdLink[] contain initially?
"hidden", it's part of a page setup code:

for (Count=0; Count < AdTotal ; 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";