[TriLUG] "Magic" navigation

Brian McCullough bdmc at bdmcc-us.com
Tue Oct 23 10:17:40 EDT 2007


Folks,

I have been working on this for more than a month ( with interruptions
), so am finally asking for help.


I have a PHP web page that calls itself ( <form action="me.php" ) in
response to buttons being clicked on the page.

This page shows various blocks of content -- think "paragraphs" -- in
response to a set of buttons at the top, a sort of navigation area.  One
or more of these buttons may be clicked randomly, exposing or hiding
some of the page's content.

So far, so good.

However, the client also wants to be able to go to the location of the
text that was exposed by the last button click.  ( We won't talk about
what happens when that text is hidden by the click. )

In the past, I have used a neat bit of JavaScript that will return you
to the location of a button that is clicked in a form, but that won't
work here, because all of the buttons are at the top and the actual
targets are farther down.

Because the location of the block of text can vary, depending on the
number of blocks that exist above that block, I don't see any practical
way of recording that location _before_ the page is re-drawn.

I have tried putting bits of JS into the page, trying to "remember" the
location of each block as it is drawn, and then doing a "GoTo" at the
bottom of the page, but that doesn't seem to do anything; it just goes
to the top.

I thought of "anchors" attached to each block, and putting a
"hash-target" on the form action, but that would have to be known before
the button was clicked, wouldn't it?

In any case, I have run into too many walls, and so am asking whether
anybody else can offer suggestions leading me to a solution.


Thank you,
Brian





More information about the TriLUG mailing list