A brief introduction. I’m completely new to javascript but am hoping it will help solve this issue:
I’m trying to be able to click a bookmark and find detailed weather for the current day with one click. I know that you can use java in the address bar to go to a particular link.
e.g. (with no breaks)
javascript:location.href=’
The particular link I need, requires the current day of the year number as part of the link. Day of year can be calculated with this formula:
Date.prototype.getDOY = function() {
var onejan = new Date(this.getFullYear(),0,1);
return Math.ceil((this – onejan) / 86400000)-1;
}
How can I use java to calculate the current day of the year and insert it into the url? All on one line so it can be saved as a bookmark on Firefox.
Thanks for any help on this.