Results 1 to 10 of 10

Thread: Hyperlinks on dates (basic html calendar)

  1. #1
    Join Date
    Aug 2017
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Exclamation Hyperlinks on dates (basic html calendar)

    1) Script Title: Basic Calendar

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...iccalendar.htm

    3) Describe problem: I need to add my own hyperlinks to specific dates on this calendar, I'm not too experienced in any of this and I think it would be better to just ask instead of spending a ton of time figuring it on my own. Google wasn't of much help but a similar question was asked years ago, it just did it differently. I can't figure out how to make it work the way I want.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,252
    Thanks
    75
    Thanked 3,395 Times in 3,356 Posts
    Blog Entries
    12

    Default

    How did it do it? And how do you want it done?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Aug 2017
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Hey! You're the same guy that replied to the last question about this. The one you did sent it to a specific page named after the date like Dec 10th 2016 would sent to the page 12102016.htm or something like that. What I need is to be able to link specific dates to actual web links like to google.com or any other website for example. Thank you for replying

  4. #4
    Join Date
    Aug 2017
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    here was the thread I found about it but it didn't accomplish what I wanted it to http://www.dynamicdrive.com/forums/s...ith-hyperlinks

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,252
    Thanks
    75
    Thanked 3,395 Times in 3,356 Posts
    Blog Entries
    12

    Default

    OK, working from that thread, make your special days array look like so:

    Code:
    var specialDays=new Array()
    // set special days for links below: specialDays[x]=['month_number', 'date_number', 'year_number', 'link', 'optional_target']
    specialDays[0]=['12', '25', '2005', 'http://www.google.com/', '_blank']
    specialDays[1]=['1', '1', '2006', 'http://www.dynamicdrive.com/']
    and change this

    Code:
    if ([mi+1]==specialDays[i_tem][0]&&[i-offsetD+1]==specialDays[i_tem][1]){
    calA[i].innerHTML='<a href="'+([mi+1].toString(10).length<2? '0'+[mi+1] : [mi+1] )+([i-offsetD+1].toString(10).length<2? '0'+[i-offsetD+1] : [i-offsetD+1])+cal_y.innerHTML+'.htm">'+[i-offsetD+1]+'</a>';
    break
    }
    to:

    Code:
    if ([mi+1]==specialDays[i_tem][0]&&[i-offsetD+1]==specialDays[i_tem][1]&&cal_y.innerHTML==specialDays[i_tem][2]){
    calA[i].innerHTML='<a href="' + specialDays[i_tem][3] + '"' + (specialDays[i_tem][4]? ' target="' + specialDays[i_tem][4] + '"' : '') + '>'+[i-offsetD+1]+'</a>';
    break
    }
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    Aug 2017
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Works exactly how it should, thank you.

  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,252
    Thanks
    75
    Thanked 3,395 Times in 3,356 Posts
    Blog Entries
    12

    Default

    Great! I'm not sure if you would want/need this, or maybe someone else reading here would, we can make it so that the year is optional, so that if instead of a year, you could put 'all' and that would make that special date active in that month for all years, ex:

    Code:
    var specialDays=new Array()
    // set special days for links below: specialDays[x]=['month_number', 'date_number', 'year_number', 'link', 'optional_target']
    specialDays[0]=['12', '25', '2005', 'http://www.google.com/', '_blank']
    specialDays[1]=['1', '1', 'all', 'http://www.dynamicdrive.com/']
    To make that work, we would need to make that other part like so:

    Code:
    if ([mi+1]==specialDays[i_tem][0]&&[i-offsetD+1]==specialDays[i_tem][1]&&(specialDays[i_tem][2]=='all'||cal_y.innerHTML==specialDays[i_tem][2])){
    calA[i].innerHTML='<a href="' + specialDays[i_tem][3] + '"' + (specialDays[i_tem][4]? ' target="' + specialDays[i_tem][4] + '"' : '') + '>'+[i-offsetD+1]+'</a>';
    break
    }
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  8. The Following User Says Thank You to jscheuer1 For This Useful Post:

    centipede (08-12-2017)

  9. #8
    Join Date
    Aug 2017
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Weird problem, maybe it has to do with an update or something. But the arrows to change the month/year are now gone. Anyway to fix this?

  10. #9
    Join Date
    Aug 2017
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    another thing: I can still click the arrows to change the month or year, but they are invisible.

  11. #10
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,252
    Thanks
    75
    Thanked 3,395 Times in 3,356 Posts
    Blog Entries
    12

    Default

    I think I would need a link to your problem page to investigate.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Similar Threads

  1. Basic Calendar Help
    By jbacorn in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 03-19-2009, 02:48 PM
  2. Replies: 1
    Last Post: 04-21-2008, 10:07 AM
  3. Looking for calendar script with different backgr colors for available/reserved dates
    By monique in forum Looking for such a script or service
    Replies: 1
    Last Post: 10-03-2007, 09:29 AM
  4. Basic calendar with hyperlinks?
    By milkman671 in forum Dynamic Drive scripts help
    Replies: 9
    Last Post: 12-04-2005, 05:50 PM
  5. Basic calendar questions
    By bre in forum Dynamic Drive scripts help
    Replies: 8
    Last Post: 11-03-2005, 03:24 AM

Bookmarks

Posting Permissions

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