I create journal entry for each day using the timestamp function. Is there a way to create a link on my home page that will always take me to the current day's journal entry. If I can't do this with a script, can you add it as a function?
Jay
### Today: <span id=today>today</span>
<script>
datum= new(Date); // get today's date
sep="-"; // define separator
dy=datum.getDate(); // get day of the month
if (dy<10) dy="0"+ dy; // add leading zero when necessary
mo=datum.getMonth() + 1; // get month
if (mo<10) mo="0" + mo; // add zero
yr=datum.getFullYear(); // get year
// now put everything together, adding "tn://" in front to make it a Wikilink
res= "tn://" + yr + sep + mo + sep + dy ;
today.innerHTML=res; // and put it inside the <span> with the id=today
</script>
res= "<a href="+res+">Today</a>";<span id=today>today</span>
<script>
datum= new(Date); // get today's date
sep="-"; // define separator
dy=datum.getDate(); // get day of the month
dy2= parseInt(dy,10) + parseInt(1,10);
dy3= parseInt(dy,10) + parseInt(-1,10);
if (dy<10) dy="0"+ dy; // add leading zero when necessary
if (dy2<10) dy2="0"+ dy2; // add leading zero when necessary
if (dy3<10) dy3="0"+ dy3; // add leading zero when necessary
mo=datum.getMonth() + 1; // get month
if (mo<10) mo="0" + mo; // add zero
yr=datum.getFullYear(); // get year
// now put everything together, adding "tn://" in front to make it a Wikilink
res= yr + sep + mo + sep + dy ;
res2="tn://" + yr + sep + mo + sep + dy2;
res3="tn://" + yr + sep + mo + sep + dy3;
res2= "<a href="+res2+">Tomorrow</a";
res3= "<a href="+res3+">Yesterday</a";
today.innerHTML=res; // and put it inside the <span> with the id=today;
tomorrow.innerHTML=res2;
yesterday.innerHTML=res3;
</script>
Users browsing this forum: No registered users and 0 guests