I'm in the process of developing a virtual 'directory' for various locations in my city to assist fellow students. Here's the concept:
On a map, I've pinned all the locations
Clicking on these pins triggers a JavaScript function that generates a brief overview next to the map.
My goal is to include a script within the existing script which, based on the day (using a case statement), displays the opening and closing hours of each location.
I'm relatively new to this and uncertain if there are any logical barriers preventing this from functioning. Below is my code:
The initial JavaScript snippet:
brukbar = "<h4>Brukbar & Supa</h4>
<img src=__PICTURE class=bilde_lite><br>
<span class=beskrivelse_klikk>
<b>Åpent: </b> **->> THIS IS WHERE I WANT THE SCRIPT FOR OPENING DAY <<-** <br>
<b>Rating: </b>
<br><hr>
__DESCRIPTION LOCATION__
</span>
<hr> <a href=# target=_blank>External page</a><br>"
Below is the case study:
var d=new Date();
var theDay=d.getDay();
switch (theDay)
{
case 1:
document.write("08-20");
break;
case 2:
....
case 0:
document.write("08-20");
}
Is it possible to encapsulate this as a function (as shown above) and then call it within the main script? I attempted to do so but only managed to display the opening time on a blank page.
I may be taking an overly convoluted approach to this task, so I welcome any suggestions or guidance (Note: I prefer not to create separate pages for each location).