The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Site description randomizer

3 posters

Go down

Solved Site description randomizer

Post by Bloxx September 21st 2016, 10:54 pm

Hello, I am here today again to ask for help on a site description randomizer, Where the site description's text will change once a page refreshes. I have tried this code but it did not work

Code:
script type="text/javascript">//<![CDATA[
(function() {
  var message = [
    'Message 1',
    'Message 2',
    'Message 3'
  ];
 
  document.write(message[Math.floor(Math.random() * message.length)]);
})();
//]]></script>

I think I was using one for a different PHP. maybe a Phpbb2 or something other than Phpbb3 ( I'm using Phpbb3 by the way ) and I just couldn't get it to work.. Is this for Phpbb3? Or am I just doing something wrong?


Last edited by Bloxx on September 21st 2016, 11:13 pm; edited 1 time in total
Bloxx
Bloxx
New Member

Posts : 6
Reputation : 1
Language : English

http://otincinerator.forumotion.com/

Back to top Go down

Solved Re: Site description randomizer

Post by SLGray September 21st 2016, 11:05 pm

When posting codes, please use the code tags.


Site description randomizer Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51489
Reputation : 3519
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Solved Re: Site description randomizer

Post by Ch@lo Valdez September 22nd 2016, 1:29 am

ok, remove your code and try with this:

Code:

$(function(){
    var a = document.getElementById('phpbb'),
    b = document.getElementById('logo-desc'),
        c = [
            'Message 1',
            'Message 2',
            'Message 3',
            'Message 4',
            'Message 5',
            'Message 6',
            'Message 7'
        ];
a &&  b && (b.lastChild.textContent= c[Math.floor(Math.random() * c.length)]);
});
Ch@lo Valdez
Ch@lo Valdez
Forumember

Male Posts : 138
Reputation : 50
Language : spanish

Back to top Go down

Solved Re: Site description randomizer

Post by Bloxx September 22nd 2016, 1:46 am

Thanks it worked! Topic Solved!
Bloxx
Bloxx
New Member

Posts : 6
Reputation : 1
Language : English

http://otincinerator.forumotion.com/

Back to top Go down

Solved Re: Site description randomizer

Post by SLGray September 22nd 2016, 3:18 am

Problem solved & topic archived.
Please read our forum rules: ESF General Rules


Site description randomizer Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51489
Reputation : 3519
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum