vForums Support > Programming & Coding :: Code Requests & Support :: > Change News name [support]

Change News name [support] - Posted By Nick (nickb) on 7th Nov 08 at 12:57am
Code:
 
  1. <script type="text/javascript">
  2. <!--
  3. /*Change News name
  4. Please do not repost
  5. http://icodes.vforums.co.uk*/
  6.  
  7. var span = document.getElementsByTagName("span");
  8. for (e = 0 ; e < span.length ; e ++) {
  9. if (span[e].className.match(/forum_news/i)) {
  10. span[e].innerHTML = span[e].innerHTML.replace('News','Welcome to the {Forbidden}~{Reunion}');
  11. }
  12. }
  13.  
  14. //-->
  15. </script>
  16.  
 


I tried my best on this, but for some reason it wont work {Sad}

Can anyone possibly please fix this for me?

Thanks

Re: Change News name [support] - Posted By Marc (cr0w) on 7th Nov 08 at 8:00pm
The reason it's not working is because the news title bar is in a td, not a span element. Also, is no "forum_news" class. There is a "forum_news" ID, however, which you could use to get to the News title bar.

Something like this would work:

Code:
 
  1. <script type="text/javascript">
  2. <!--
  3. /*Change News name
  4. Please do not repost
  5. http://icodes.vforums.co.uk*/
  6.  
  7. var forum_news = document.getElementById("forum_news").parentNode.previousSibling;
  8.  
  9. forum_news.innerHTML = forum_news.innerHTML.replace('News','Welcome to the {Forbidden}~{Reunion}');
  10.  
  11. //-->
  12. </script>
 


{Smile}

Re: Change News name [support] - Posted By Nick (nickb) on 7th Nov 08 at 9:46pm
Oh ok I see

But sorry Marc, It did not work {Unsure}

Re: Change News name [support] - Posted By Marc (cr0w) on 8th Nov 08 at 9:46pm
Are you putting it in your Main Footer? The news fader loads after the headers, so the code needs to be placed in the footer to work. {Wink}

Re: Change News name [support] - Posted By Nick (nickb) on 8th Nov 08 at 10:27pm
Ohh ok, that explains it, I did not know that {Tongue Out}

It works.

If you want you can add it to the code database.

Re: Change News name [support] - Posted By Nick (nickb) on 8th Nov 08 at 10:28pm
 
The reason it's not working is because the news title bar is in a td, not a span element. Also, is no "forum_news" class. There is a "forum_news" ID, however, which you could use to get to the News title bar.

Something like this would work:

Code:
 
  1. <script type="text/javascript">
  2. <!--
  3. /*Change News name
  4. Please do not repost
  5. http://icodes.vforums.co.uk
  6. http://support.vforums.co.uk*/
  7.  
  8. var forum_news = document.getElementById("forum_news").parentNode.previousSibling;
  9.  
  10. forum_news.innerHTML = forum_news.innerHTML.replace('News','Welcome to the {Forbidden}~{Reunion}');
  11.  
  12. //-->
  13. </script>
 


{Smile}