FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

JavaScript Problem

 


jeremyyak
I am using this code for my clan forums. I modified something (which I can't recall what) and now it doesn't work. I do not receive a JavaScript error on FireFox.

I am running this on an IPB Board by InvisionFree.
It was working, then I played with it, now it does nothing.
It used to write out a User Legend under where members are listed.

I would give you a link to the forums, but you have to be a member of the board to see it.

Edit:
Yes, I know the glow tag is IE only Laughing SO no need to bring that up.


Heres the code:
Code:
<script>
var irGroup = []
irGroup[0]=["Leader", "yellow","filter:glow(color=red,strength=4); font-size: 10px; height: 1px; font-weight: bold"]
irGroup[1]=["Co-Leader", "#000A8A", "filter:glow(color=#436EEE,strength=4); font-size: 10px; height: 1px; font-weight: bold"]
irGroup[2]=["High Council", "#2C006C", "filter:glow(color=#BF3EFF,strength=3); font-size: 10px; height: 1px; font-weight: bold"]
irGroup[3]=["Warlord", "red", "filter:glow(color=green,strength=2); font-size: 10px; height: 1px; font-weight: bold"]
irGroup[4]=["General", "#003B00", "filter:glow(color=green,strength=4); font-size: 10px; height: 1px; font-weight: bold"]
irGroup[5]=["Designer", "yellow", "filter:glow(color=orange,strength=4); font-size: 10px; height: 1px; font-weight: bold"]
irGroup[6]=["GE Legend", "cyan", "filter:glow(color=blue,strength=4); font-size: 10px; height: 1px; font-weight: bold"]
irGroup[7]=["GE Elite", "red", "filter:glow(color=purple,strength=4); font-size: 10px; height: 1px; font-weight: bold"]
irGroup[8]=["Warrior", "yellow", "filter:glow(color= green,strength=4); font-size: 10px; height: 1px; font-weight: bold"]
irGroup[9]=["Soldier", "white", "filter:glow(color=gray,strength=4);font-size: 10px; height: 1px; font-weight: bold"]
irGroup[10]=["Future Applicant", "#464646", "filter:glow(color=white,strength=4);  font-size: 10px; height: 1px; font-weight: bold"]
irGroup[11]=["Guest", "gray", "font-weight: bold"]

var usersInput=""
for (i=0;i<irGroup.length;i++) {

if (i==0){
usersInput+="<font style='" + irGroup[i][2] + "' color='" + irGroup[i][1] + "'>" + irGroup[i][0] + "</font>"
}
else{
usersInput+=" | <font style='" + irGroup[i][2] + "' color='" + irGroup[i][1] + "'>" + irGroup[i][0] + "</font>"
}

}

var tCell = document.getElementsByTagName('TD')
for (i=0;i<tCell.length;i++) {

if (tCell[i].width=="100%" && tCell[i].innerHTML.match(/anonymous members/i)) {
tCell[i].getElementsByTagName('DIV')[0].innerHTML+="<br /><br /><b>User Key:</b><br /> [" + usersInput + "]"
}

}
</script>


Thanks in advanced,
~Jeremy~
Straevaras
Ok, the only thing I can see that is going wrong is that you're running the script in your <head> tag before the rest of the body is even loaded. So when the script runs, it doesn't have any <td> tags to look through and the search fails, and resultantly the script does nothing. If you make this entire script a function and add onload="functionName()" to your <body>, the script will run after all your elements in the page are loaded.

I've tested this script in IE7 and Firefox 2 and it works in both. What browsers did this not work in for you?
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.