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.

Javascript code help?

2 posters

Go down

Solved Javascript code help?

Post by ThePhantomHourglass Thu 6 Mar - 22:05

What I want to do is make a JavaScript code in the JavaScript code management area thingy. What I want the code to do, is to set a certain warning message on the top of the page* that displays a custom text message in a red box.

*What I mean by top of the page:
The box would go where the red box is currently surrounding in the image below
Javascript code help? Ozawnw10


This is what the notification box would look like:
Javascript code help? Gbejld10


Last edited by ThePhantomHourglass on Thu 6 Mar - 23:27; edited 1 time in total
ThePhantomHourglass
ThePhantomHourglass
New Member

Male Posts : 11
Reputation : 1
Language : English

http://aresiiocorpforums.forumotion.com/

Back to top Go down

Solved Re: Javascript code help?

Post by Ange Tuteur Thu 6 Mar - 22:34

Hello ThePhantomHourglass,

The announcements should already show on all the pages. What exactly would you like the code to do ?
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Javascript code help?

Post by ThePhantomHourglass Thu 6 Mar - 22:45

Ange Tuteur wrote:Hello ThePhantomHourglass,

The announcements should already show on all the pages. What exactly would you like the code to do ?
For it to do the same but with that box. I'll have Announcements disabled and I'll change the announcement text via the code.
ThePhantomHourglass
ThePhantomHourglass
New Member

Male Posts : 11
Reputation : 1
Language : English

http://aresiiocorpforums.forumotion.com/

Back to top Go down

Solved Re: Javascript code help?

Post by Ange Tuteur Thu 6 Mar - 22:53

Okay, try this :
* tick in all the pages
Code:
$(function() {
    var message = 'Message content';
    $('#pun-head').after('<div class="module main"><div class="main-content clearfix">'+message+'</div></div>')
});
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Javascript code help?

Post by ThePhantomHourglass Thu 6 Mar - 22:59

Ange Tuteur wrote:Okay, try this :
* tick in all the pages
Code:
$(function() {
    var message = 'Message content';
    $('#pun-head').after('<div class="module main"><div class="main-content clearfix">'+message+'</div></div>')
});
Awesome, thanks! It works. One last thing, how would I get the text to be centered, colored white, size 16px font, and the box to be red (#FF0000) with a black border?
ThePhantomHourglass
ThePhantomHourglass
New Member

Male Posts : 11
Reputation : 1
Language : English

http://aresiiocorpforums.forumotion.com/

Back to top Go down

Solved Re: Javascript code help?

Post by Ange Tuteur Thu 6 Mar - 23:16

Try this :
Code:
$(function() {
    var settings = {
        message : 'Message content',
        style : 'text-align:center;color:white;font-size:16px;font-weight:bold;border:2px solid black;',
        innerstyle : 'background:red;border:none;'
    };
    
    $('#pun-head').after('<div class="module main" style="'+settings["style"]+'"><div class="main-content clearfix" style="'+settings["innerstyle"]+'">'+settings["message"]+'</div></div>');
    
});

I've added some settings to edit the box style. You can also use HTML in the message content.
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Javascript code help?

Post by ThePhantomHourglass Thu 6 Mar - 23:26

Ange Tuteur wrote:Try this :
Code:
$(function() {
    var settings = {
        message : 'Message content',
        style : 'text-align:center;color:white;font-size:16px;font-weight:bold;border:2px solid black;',
        innerstyle : 'background:red;border:none;'
    };
    
    $('#pun-head').after('<div class="module main" style="'+settings["style"]+'"><div class="main-content clearfix" style="'+settings["innerstyle"]+'">'+settings["message"]+'</div></div>');
    
});

I've added some settings to edit the box style. You can also use HTML in the message content.
It works! Thank you very much for helping me.
ThePhantomHourglass
ThePhantomHourglass
New Member

Male Posts : 11
Reputation : 1
Language : English

http://aresiiocorpforums.forumotion.com/

Back to top Go down

Solved Re: Javascript code help?

Post by Ange Tuteur Thu 6 Mar - 23:45

You're welcome I love you

Topic solved and archived
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Back to top

- Similar topics

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