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.

javascript IF statement response

View previous topic View next topic Go down

In progress javascript IF statement response

Post by No0ne on February 15th 2014, 8:52 am

first of all, i dont speak english so sorry if you see some mistakes. salut 
just today i saw this post http://help.forumotion.com/t130190-javascript-if-statement and it has been closed so i  could not answer.

this code might help to nick ( im not expert in javascript but i do my best), what the code make is to compare the current date with a date set by you, if they match then run something determined by you ( like create some html), and you can set multiple dates.
This is an example code: here I set decoration for halloween  ( i used some jquery code on this)

Code:
var yourDate = new Array();
//Beginning of code you can change
// format Year/Month/Day
yourDate[0] = "2014/10/31";
yourDate[1] = "2014/12/25";
yourDate[2] = "other date";
//End of code you can change
var dt = new Date();
var year = dt.getFullYear();
var month = dt.getUTCMonth()+1;
var day = dt.getDate();
var today = year + "/" + month + "/" + day;
for (var i=0; i<yourDate.length; i++) {
if (yourDate[i] == today)
  {
      if (today == yourDate[0]) {
          //CODE HERE
          alert("Happy Halloween!!");
          halloween();
      }
      if (today == yourDate[1]) {
          // OTHER CODE HERE
          alert("Merry Christmas!!");
      }
      if (today == yourDate[2]) {
          // OTHER CODE HERE
          alert("Hi, this is a test");
      }
   }
 }
function halloween() {
    $(document).ready(function(){
        $(document.body).append("<marquee direction='left' scrolldelay='100' style='position:fixed; top:15px; right:0; width:100%;'><img src='http:\/\/www.halloween.com.es\/gifs-animados\/murcielagos\/anibat1-11.gif' style=\"border:0; background:none; padding:0; box-shadow: none;\"\/><\/marquee>");
        $(document.body).append("<img src='http:\/\/www.halloween.com.es\/gifs-animados\/rotulos\/32523129.gif' width='135' style='position:fixed; bottom:0; left:0;' title='Happy Halloween!!'\/>");
        });
}

Its just an example, you can edit as you like cheers 
Greetings to all - Saludos a todos Wink

No0ne
New Member

Posts : 2
Reputation : 1
Language : Spanish and a little english

http://help.forumotion.com

Back to top Go down

In progress Re: javascript IF statement response

Post by Base on February 15th 2014, 11:38 am

Hello,

What is this? Are you having a problem with the code?

Base
Forumaster

Male Posts : 10386
Reputation : 1687
Language : English and French
Location : United Kingdom, England

http://forumotionhub.net

Back to top Go down

In progress Re: javascript IF statement response

Post by No0ne on February 16th 2014, 10:19 am

no, i just wanted to help to this http://help.forumotion.com/t130190-javascript-if-statement but is locked, just that.  Hello

No0ne
New Member

Posts : 2
Reputation : 1
Language : Spanish and a little english

http://help.forumotion.com

Back to top Go down

In progress Re: javascript IF statement response

Post by Darkel on February 16th 2014, 10:27 am

Hi,

Thank you for you kind in helping a user thumleft ,   although the topic has been locked since !_NICK_! requested it. And this forum section are users who needs help by posting their problems, If you still want to help him, you can send the following codes via PM to !_NICK_!


Regards,
Time

Darkel
Hyperactive

Male Posts : 2128
Reputation : 257
Language : English, Tagalog
Location : Philippines

Back to top Go down

In progress Re: javascript IF statement response

Post by Base on February 16th 2014, 11:41 am

Ah, I see... Well, you should inform the user of this topic via private message so that he can see it. This topic will be locked, though, since it's not a support request. Thanks for understanding.

Base
Forumaster

Male Posts : 10386
Reputation : 1687
Language : English and French
Location : United Kingdom, England

http://forumotionhub.net

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