The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Site description randomizer

View previous topic View next topic Go down

Solved Site description randomizer

Post by Bloxx on 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
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 on September 21st 2016, 11:05 pm

When posting codes, please use the code tags.


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


SLGray
Administrator
Administrator

Male Posts : 36705
Reputation : 2445
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

Solved Re: Site description randomizer

Post by Ch@lo Valdez on 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
Forumember

Male Posts : 100
Reputation : 31
Language : spanish

Back to top Go down

Solved Re: Site description randomizer

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

Thanks it worked! Topic Solved!

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 on September 22nd 2016, 3:18 am

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


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


SLGray
Administrator
Administrator

Male Posts : 36705
Reputation : 2445
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

View previous topic View next topic Back to top


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