View Full Version : onload jump to calculated anchor
09-27-2005, 12:51 AM
I have a calendar, an html page that writes the whole month from three .js files. There's a named anchor at the start of each day:
<a name="' + day + '"></a>
When the page loads I would like it to arrive at the anchor for today's date (day)
I'm sure this must be easy, I just can't get it to work :(
09-27-2005, 04:32 AM
Idea #1: A link is worth a thousand words.
09-27-2005, 10:14 AM
Ok, sorry, did that not make any sense. I can't put the actual link up I'm afraid as it's a work calendar and the boss won't appreciate it. I'll try to explain a bit more clearly...#
month.htm runs three .js files:
the first is all the regular events
the second is all the stuff about what day today is and leap years etc.
the third writes the html code for the page and ends with...
The original html page that we started with loads the three .js files in the <head> tag, and the body tag looks like this
I've tried various ways of adding something like...
as 'day' is the variable for today and each named anchor is named by this variable like this...
'<a name="' + day + '"></a>'
Like I said I'm sure it should be easy I just don't know the syntax.
There's my thousand words, a link sure would have been easier...
09-27-2005, 12:56 PM
This should have been server side application.
<body onload="document.write(diary);document.close();"></body> - overwrites existing page, adding anything here is useless
Just add something like that: <a href="#today">Go to todays events</a> to the top of your diary code - it is a extra click, but it also is an easy solution....
09-27-2005, 02:28 PM
That's certainly an option but it already does that - the front page already shows todays events. I just want the monthly diary to display more relevantly, so you can see the next few days or scroll back up to see what you've missed rather than arriving at the first of the month. There must be a way :confused:
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.