Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    262
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Javascript Calendar

    Hi

    I'm looking for a calendar like the following - http://javascript.internet.com/calen...-calendar.html

    I want the calendar to read events from a text file so when you when click on the date it will display the events for that date. If there are any events, I would like some text in the day box.... http://javascript.internet.com/calen.../calendar.html

    Any ideas on how to do this? Or has anyone seen a better example?

    Thanks

  • #2
    New Coder
    Join Date
    Jun 2004
    Location
    Coventry, UK
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Javascript Rules

    With the bit about reading form a text file, if it resides on the viewers PC, its impossible to acess. This is because when Javascript was designed, to make it safe for users, Javascript cannot acess files or write to files on a users PC. The only way to store data on a users PC is using a Cookie, and these can be blocked easily.

    It would be possible tough with a Java Applet and some CGI, but im no expert in either. Sorry. For the Java try this site, java.net.

    Sorry

    LOTS8

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    262
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi

    Sorry - I haven't explained it well.

    I would like it to read from a .js file on the web server that I can physically edit to put new events on.

    Any ideas

  • #4
    New Coder
    Join Date
    Jun 2004
    Location
    Coventry, UK
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Sos

    Sos, my mistake. It should be OK this way.
    LOTS8

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    262
    Thanks
    0
    Thanked 0 Times in 0 Posts
    any ideas?

  • #6
    New Coder
    Join Date
    Jun 2004
    Location
    Coventry, UK
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Some

    Ill work on it. I cant promise much though.
    LOTS8

  • #7
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,043
    Thanks
    0
    Thanked 251 Times in 247 Posts
    You should store the events in an array that are structured like this:
    Code:
    var arrEvents = new Array();
    arrEvents['07-09-2004'] = new Array();
    arrEvents['07-09-2004'][0] = "event 1";
    arrEvents['07-09-2004'][1] = "event 2";
    arrEvents['07-09-2004'][2] = "event 3";
    
    arrEvents['07-10-2004'] = new Array();
    arrEvents['07-10-2004'][0] = "event 1";
    arrEvents['07-10-2004'][1] = "event 2";
    
    ...
    Then call this in each date link passing the corresponding date in mm-dd-yyyy format or using your desired format.
    Code:
    function viewEvents(dateIndex){
       var temp = arrEvents[dateIndex];
       if (temp){
          var evts = '';
          for (var i=0;i<temp.length;i++){
              evts += temp[i] + '\n';
          }
          if (evts!=''){
             alert('Events for ' + dateIndex + ':\n' + evts);
          }
          else {
             alert('No events for ' + dateIndex + ".");
          }
       }   
       return false;
    }
    ...
    <a href="#" onclick="return viewEvents('07-09-2004')">9</a>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •