Skip to content

Instantly share code, notes, and snippets.

@trigolgy
Last active April 9, 2017 21:01
Show Gist options
  • Save trigolgy/097b41a01d659a399d48abee3283bce5 to your computer and use it in GitHub Desktop.
Save trigolgy/097b41a01d659a399d48abee3283bce5 to your computer and use it in GitHub Desktop.
guncel tarihe gore sayfa yonlendirmesi yapan js metodu
function load() {
var date = new Date();
var currentDay = date.getDate();
var currentMonth = date.getMonth();
var currentDayStr = currentDay.toString();
var currentMonthStr = currentMonth.toString();
var day_month = currentDayStr.concat('-',currentMonthStr);
console.log(currentDay );
console.log(currentMonth );
console.log(day_month );
switch (day_month) {
// yeni yil
case '01-0':
window.location.href = "www.google.com";
break;
// 23 nisan
case '23-3':
window.location.href = "www.tubitak.gov.tr";
break;
// 19 mayis
case '19-4':
window.location.href = "https://www.tbmm.gov.tr";
break;
}
}
window.onload = load;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment