A Challenge! (Setting table cell background permanently)

G

Gary Hasler

I have a full page of thumbnails linked to home plan pages. I'm adding
a mouseover/mouseout effect to the table cells, plus a onclick event to
permanently set the cell background to indicate the user's latest
choice. This is in addition to the normal A HREF link, and seems to
work fine. I set up anchors (A name="") on the thumbnail page, and the
"Back to Plans" link from the home plan page contains a hash (#) to
scroll the page down and also re-highlight the appropriate table cell.

This works great if the user uses my link to return to the thumbnail
page. But what I would REALLY like is if it also worked if they click
their browser's Back button instead! Can anyone think of a way to do
this? I know the browser remembers certain things about the previous
page, such as contents of form fields and where the user has scrolled
to.

The test page is at:
http://www.thelogconnection.com/stock_plansx.html
 
L

Lasse Reichstein Nielsen

Gary Hasler said:
I know the browser remembers certain things about the previous page,
such as contents of form fields and where the user has scrolled to.

That depends *heavily* on the browser.

E.g., Opera keeps the page active in memory (as far as the memory
cache allows), and going back to the page will not reinitialize it at
all, just continue where it left. (That's actually the best you can get,
you can just highlight the cell when it's clicked).

Mozilla FireFox reinitializes/reloads the page and doesn't seem to
remember the values of form controls.

IE reloads the page and reinstates the value of form controls.

By best suggestion is to use a cookie, if you want to remember from
access to access, whether by "back" key or not (and know that not all
browsers reloads the page when clicking "back").

/L
 
G

Gary Hasler

That's kinda what I thought. I'm not sure it's worth getting into cookies,
especially as so many people (myself included) have turned cookies off at times,
or changed the setting to "prompt", for whatever reasons. The other alternative
I've considered is changing the page to a PHP page and getting into
sessions...but that might be more trouble than it's worth for the result.

However, you just gave me an idea....what if the onClick js function sets a
hidden form element to the value of the clicked link? I'll give that a try...
---------------------
 
F

Frank

Gary,

before thinking of a technical solution, think about the functional first.
What do you want when the user gets back. Where will the mouse be and which
image is highlighted? When do you switch off the highlight of the choice the
user made the first time?
Frank
 
G

Gary Hasler

Actually, I don't want to change much. The intent is for the visitor to remember
where they are in the thumbnail table, as they may spend several minutes viewing
the house plan. The highlight is a typical mouseover, and when the user clicks
the highlight becomes permanent and the previous highlight is de-highlighted (is
that a word?)

When the user clicks the browser back button, the window scroll position will be
wherever it was when the page was unloaded. That's perfect, so I want to ignore
the # anchor in that case, which for instance IE does even though the anchor
still shows in the address bar. The only thing I want is the highlight to
remind them which one they picked. Maybe I can do something with the
link.visited property?
---------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,479
Members
44,900
Latest member
Nell636132

Latest Threads

Top