Results 1 to 9 of 9

Thread: script>//Online/Offline Legend v2

  1. #1
    Join Date
    Jan 2006
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default script>//Online/Offline Legend v2

    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

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    For a start, you should surround the value of the src attribute with quotes.
    Code:
    sPost.innerHTML+="<p align=\"center\"><img src=\""+dir+"\"offline.gif"+"></p>"
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Jan 2006
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Twey
    For a start, you should surround the value of the src attribute with quotes.
    Code:
    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
    Last edited by XXSUPERHEROXX; 01-31-2006 at 08:56 PM.

  4. #4
    Join Date
    Jan 2006
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by XXSUPERHEROXX
    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"+">

  5. #5
    Join Date
    Jan 2006
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default script code show

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

  6. #6
    Join Date
    Jan 2006
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default update in the life of a superhero

    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

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

  7. #7
    Join Date
    Jan 2006
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default up date in the life of a superhero

    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>

  8. #8
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    ... a <color> tag?!
    And you've totally disregarded what I said about quotes.
    Code:
    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>"
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  9. #9
    Join Date
    Jan 2006
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default It works!!!!!!!

    Quote Originally Posted by Twey
    ... a <color> tag?!
    And you've totally disregarded what I said about quotes.
    Code:
    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!

Bookmarks

Posting Permissions

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