javascript IF statement response
3 posters
Page 1 of 1
javascript IF statement response
first of all, i dont speak english so sorry if you see some mistakes.
just today i saw this post https://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)
Its just an example, you can edit as you like
Greetings to all - Saludos a todos
just today i saw this post https://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
Greetings to all - Saludos a todos
Re: javascript IF statement response
no, i just wanted to help to this https://help.forumotion.com/t130190-javascript-if-statement but is locked, just that.
Re: javascript IF statement response
Hi,
Thank you for you kind in helping a user , 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
Thank you for you kind in helping a user , 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
Stephen-- Hyperactive
- Posts : 2542
Reputation : 326
Language :
Re: javascript IF statement response
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.
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum