Log in

View Full Version : script>//Online/Offline Legend v2



XXSUPERHEROXX
01-31-2006, 01:29 PM
so I was looking for codes for my site and I was looking for a on line off line code. I found this one on a site but and how ever. it does not show the icons. I went back to the site I found it on but it does not work on his site as well so I cant ask him whats wrong because he has the same problem.

I know its aplying because it make a little box wherethe icon goes but its a box with a dot. for both on line off line. how do I fix the glitch?? I seen other site have text on line off line in place of the icon both would be fine with me heres the code.

<script>//Online/Offline Legend v2 - By Markup
dir="http://webpost.net/ma/markup/"
home=location.href.lastIndexOf("/")>26?location.href.substr(0,location.href.lastIndexOf("/")):location.href
names=[]
if(top.location==location)
document.write("<IFRAME id=index name=index src="+home+" width=0 height=0 border=0 frameBorder=0></IFRAME>")
else
{
div=document.body.getElementsByTagName("DIV")
for(i=0;i<div.length;i++)
if(div[i].className=="thin")
break
a=div[i].getElementsByTagName("A")
for(i=0;i<a.length;i++)
names[i]=a[i].innerHTML.replace(/<[^>]+>/g,"")
parent.updateStatus()
}
function updateStatus()
{
td=document.body.getElementsByTagName("TD")
for(i=0;i<td.length;i++)
if((td[i].className=="post1"||td[i].className=="post2")&&td[i].innerHTML.match("Posts: ")&&td[i].width!="100%")
{
found=false
sPost=td[i].getElementsByTagName("SPAN")[0]
names=parent.frames['index'].names
for(a=0;a<names.length;a++)
if(td[i-2].innerHTML.replace(/<[^>]+>/g,"")==names[a])
{
sPost.innerHTML+="<P align=center><IMG SRC="+dir+"online.gif"+"></P>"
found=true
}
if(!found)
sPost.innerHTML+="<P align=center><IMG SRC="+dir+"offline.gif"+"></P>"
}
}
</script>


if any one could help me out that would be awesome thank you for your time

if you would like to see the box with the dot my sites www.xxsuperheroxx.com

Twey
01-31-2006, 04:13 PM
For a start, you should surround the value of the src attribute with quotes.

sPost.innerHTML+="<p align=\"center\"><img src=\""+dir+"\"offline.gif"+"></p>"

XXSUPERHEROXX
01-31-2006, 08:46 PM
For a start, you should surround the value of the src attribute with quotes.

sPost.innerHTML+="<p align=\"center\"><img src=\""+dir+"\"offline.gif"+"></p>"
ok I did that it still has the box and dot you help did not stop the program from working but its did not fix it. thanks for trying to help out i dont under stand why its not working right. would space between the scripts stop the images from posting?? I left room so I can tell the scripts apart so if they stop pother codes lick the scroller I could delete the program that made the others stop working.

so far ever thing is still working.



<script>//Online/Offline Legend v2 - By Markup
dir="http://webpost.net/ma/markup/"
home=location.href.lastIndexOf("/")>26?location.href.substr(0,location.href.lastIndexOf("/")):location.href
names=[]
if(top.location==location)
document.write("<IFRAME id=index name=index src="+home+" width=0 height=0 border=0 frameBorder=0></IFRAME>")
else
{
div=document.body.getElementsByTagName("DIV")
for(i=0;i<div.length;i++)
if(div[i].className=="thin")
break
a=div[i].getElementsByTagName("A")
for(i=0;i<a.length;i++)
names[i]=a[i].innerHTML.replace(/<[^>]+>/g,"")
parent.updateStatus()
}
function updateStatus()
{
td=document.body.getElementsByTagName("TD")
for(i=0;i<td.length;i++)
if((td[i].className=="post1"||td[i].className=="post2")&&td[i].innerHTML.match("Posts: ")&&td[i].width!="100%")
{
found=false
sPost=td[i].getElementsByTagName("SPAN")[0]
names=parent.frames['index'].names
for(a=0;a<names.length;a++)
if(td[i-2].innerHTML.replace(/<[^>]+>/g,"")==names[a])
{
sPost.innerHTML+="<p align=\"center\"><img src=\""+dir+"\"Online.gif"+"></p>"

found=true
}
if(!found)
sPost.innerHTML+="<p align=\"center\"><img src=\""+dir+"\"offline.gif"+"></p>"

}
}
</script>


could it be that Invision Power Board does not have this gif in its dir?? how would I change it to bold text? online / offline

XXSUPERHEROXX
01-31-2006, 11:32 PM
ok I did that it still has the box and dot you help did not stop the program from working but its did not fix it. thanks for trying to help out i dont under stand why its not working right. would space between the scripts stop the images from posting?? I left room so I can tell the scripts apart so if they stop pother codes lick the scroller I could delete the program that made the others stop working.

so far ever thing is still working.




could it be that Invision Power Board does not have this gif in its dir?? how would I change it to bold text? online / offline



why cant I put some thing like this
<off line>



<on line>


in place of the
<img src=\""+dir+"\"offline.gif"+">

XXSUPERHEROXX
01-31-2006, 11:49 PM
LMAO ok so heres what I did I put this in the code


<script>//Online/Offline Legend v2 - By Markup
dir="http://webpost.net/ma/markup/"
home=location.href.lastIndexOf("/")>26?location.href.substr(0,location.href.lastIndexOf("/")):location.href
names=[]
if(top.location==location)
document.write("<IFRAME id=index name=index src="+home+" width=0 height=0 border=0 frameBorder=0></IFRAME>")
else
{
div=document.body.getElementsByTagName("DIV")
for(i=0;i<div.length;i++)
if(div[i].className=="thin")
break
a=div[i].getElementsByTagName("A")
for(i=0;i<a.length;i++)
names[i]=a[i].innerHTML.replace(/<[^>]+>/g,"")
parent.updateStatus()
}
function updateStatus()
{
td=document.body.getElementsByTagName("TD")
for(i=0;i<td.length;i++)
if((td[i].className=="post1"||td[i].className=="post2")&&td[i].innerHTML.match("Posts: ")&&td[i].width!="100%")
{
found=false
sPost=td[i].getElementsByTagName("SPAN")[0]
names=parent.frames['index'].names
for(a=0;a<names.length;a++)
if(td[i-2].innerHTML.replace(/<[^>]+>/g,"")==names[a])
{
sPost.innerHTML+="<p align=\"center\"><img src=\""+dir+"\"<on line>"+"></p>"

found=true
}
if(!found)
sPost.innerHTML+="<p align=\"center\"><img src=\""+dir+"\"<off line>"+"></p>"

}
}
</script>

note the bold color text script for on line off line. now this is what it did to my
site link to my site page showing box and script (http://s14.invisionfree.com/XXSUPERHEROXX/index.php?showtopic=92). the programs working its just showing the box with the red dot and the script I used to post the text. so what do I have to change now to remove the box and get the text in bold and color

XXSUPERHEROXX
02-01-2006, 12:32 AM
ok so I was deleting some things and I seem to have removed the box and red dot as well as some of the script. the code still works and tells you if the member in on line or off just is showing script and not applying the colors or bold text here it the program as of so far still working

<script>//Online/Offline Legend v2 - By Markup
dir="http://webpost.net/ma/markup/"
home=location.href.lastIndexOf("/")>26?location.href.substr(0,location.href.lastIndexOf("/")):location.href
names=[]
if(top.location==location)
document.write("<IFRAME id=index name=index src="+home+" width=0 height=0 border=0 frameBorder=0></IFRAME>")
else
{
div=document.body.getElementsByTagName("DIV")
for(i=0;i<div.length;i++)
if(div[i].className=="thin")
break
a=div[i].getElementsByTagName("A")
for(i=0;i<a.length;i++)
names[i]=a[i].innerHTML.replace(/<[^>]+>/g,"")
parent.updateStatus()
}
function updateStatus()
{
td=document.body.getElementsByTagName("TD")
for(i=0;i<td.length;i++)
if((td[i].className=="post1"||td[i].className=="post2")&&td[i].innerHTML.match("Posts: ")&&td[i].width!="100%")
{
found=false
sPost=td[i].getElementsByTagName("SPAN")[0]
names=parent.frames['index'].names
for(a=0;a<names.length;a++)
if(td[i-2].innerHTML.replace(/<[^>]+>/g,"")==names[a])
{
sPost.innerHTML+="<p align=\"center\"> <on line></p>"

found=true
}
if(!found)
sPost.innerHTML+="<p align=\"center\"><off line></p>"

}
}
</script>

so what is missing or what has yet to be removed to make the text colors and not show script???

link to my site page showing script (http://s14.invisionfree.com/XXSUPERHEROXX/index.php?showtopic=92)

you have to go look at the page some script does not show on this quote.

XXSUPERHEROXX
02-01-2006, 01:28 AM
ok I found out how to get it to say on line and off line working but I still am working on colored text.

heres a working script its just has black text where I wanted green and red.


<script>//Online/Offline Legend v2 - By Markup
dir="http://webpost.net/ma/markup/"
home=location.href.lastIndexOf("/")>26?location.href.substr(0,location.href.lastIndexOf("/")):location.href
names=[]
if(top.location==location)
document.write("<IFRAME id=index name=index src="+home+" width=0 height=0 border=0 frameBorder=0></IFRAME>")
else
{
div=document.body.getElementsByTagName("DIV")
for(i=0;i<div.length;i++)
if(div[i].className=="thin")
break
a=div[i].getElementsByTagName("A")
for(i=0;i<a.length;i++)
names[i]=a[i].innerHTML.replace(/<[^>]+>/g,"")
parent.updateStatus()
}
function updateStatus()
{
td=document.body.getElementsByTagName("TD")
for(i=0;i<td.length;i++)
if((td[i].className=="post1"||td[i].className=="post2")&&td[i].innerHTML.match("Posts: ")&&td[i].width!="100%")
{
found=false
sPost=td[i].getElementsByTagName("SPAN")[0]
names=parent.frames['index'].names
for(a=0;a<names.length;a++)
if(td[i-2].innerHTML.replace(/<[^>]+>/g,"")==names[a])
{
sPost.innerHTML+="<p align=\"center\"><color=#0CF21D><b>on line</b></color></p>"

found=true
}
if(!found)
sPost.innerHTML+="<p align=\"center\"><color=#FF0000><b>off line</b></color></p>"

}
}
</script>

Twey
02-01-2006, 04:07 PM
... a <color> tag?!
And you've totally disregarded what I said about quotes.

sPost.innerHTML+="<p style=\"text-align:center;color:lime;font-weight:bold;\">Online</p>"

found=true
}
if(!found)
sPost.innerHTML+="<p style=\"text-align:center;color:red;font-weight:bold;\">Offline</p>"

XXSUPERHEROXX
02-01-2006, 04:46 PM
... a <color> tag?!
And you've totally disregarded what I said about quotes.

sPost.innerHTML+="<p style=\"text-align:center;color:lime;font-weight:bold;\">Online</p>"

found=true
}
if(!found)
sPost.innerHTML+="<p style=\"text-align:center;color:red;font-weight:bold;\">Offline</p>"

Awesome thank you! I was not ignoring your advice I am new to this all and I have been playing around tell I got it to work hummm kind of. I was just starting to play with that part I know it was the kind of script you just posted not what I was trying to use. but I did not know how to format the code when I tryed to it stopped the script from working now its fully working!!! that you so very much! heres the full working script.


<script>//Online/Offline Legend v2 - By Markup
dir="http://webpost.net/ma/markup/"
home=location.href.lastIndexOf("/")>26?location.href.substr(0,location.href.lastIndexOf("/")):location.href
names=[]
if(top.location==location)
document.write("<IFRAME id=index name=index src="+home+" width=0 height=0 border=0 frameBorder=0></IFRAME>")
else
{
div=document.body.getElementsByTagName("DIV")
for(i=0;i<div.length;i++)
if(div[i].className=="thin")
break
a=div[i].getElementsByTagName("A")
for(i=0;i<a.length;i++)
names[i]=a[i].innerHTML.replace(/<[^>]+>/g,"")
parent.updateStatus()
}
function updateStatus()
{
td=document.body.getElementsByTagName("TD")
for(i=0;i<td.length;i++)
if((td[i].className=="post1"||td[i].className=="post2")&&td[i].innerHTML.match("Posts: ")&&td[i].width!="100%")
{
found=false
sPost=td[i].getElementsByTagName("SPAN")[0]
names=parent.frames['index'].names
for(a=0;a<names.length;a++)
if(td[i-2].innerHTML.replace(/<[^>]+>/g,"")==names[a])
{
sPost.innerHTML+="<p style=\"text-align:center;color:lime;font-weight:bold;\">Online</p>"

found=true
}
if(!found)
sPost.innerHTML+="<p style=\"text-align:center;color:red;font-weight:bold;\">Offline</p>"

}
}
</script>

I have book maked this site and check it often now!