tdhammer
Member
Posted 2 years ago #
I created a template page that queries a database table and builds a list of the table contents ordered by date. I would like the current month (or the next month with entries) to be the "default" view when the page is accessed. I figure it should be easy to add anchors as I am creating the page from the database table, but how do I get the page to jump to the month of interest when it is loaded.
You can view the existing page here.
Any help would be greatly appreciated.
You can use javascript in an onload function like follows:
<body onload="window.location.hash='anchor_name';"> [...]
That should cause the user to be moved to the top of the anchor when the browser finishes loading the page
tdhammer
Member
Posted 2 years ago #
Thanks. I did not think of that since my <body> tag was included in the page from header.php/get_header(). Just made a copy of the header code in this page and added the onload attribute.
Thanks again!