How to get and restore current visible position on a page

S

Stefan Finzel

Hi,

i am a newbie on this newsgroup and no javascript programmer. May be i
missed something obvious. Please forgive me.

Using several tables (raw text and csv content only) on a page i decided
to set tables font-size:smaller.
Additionally there are links to make all/each tables font size
smaller/larger on demand and step by step. Arbitrary tables may get large.

Of cause changing the font size is changing in the web browsers visible
area of the web page. I don't like to urge the user to manually scroll
back to the table.

Now is there a simple way to get the current position (of the link just
clicked), to resize the font and move the browsers view back to/near
this position?


function font_size_change(tbl, dsize) {
// ??? get position or element or whatever using self ???
var size = parseInt(document.body.style.fontSize);
size += parseInt(dsize);
if (size > FONT_MAXSIZE) { size = FONT_MAXSIZE; }
if (size < FONT_MINSIZE) { size = FONT_MINSIZE; }
tbl.style.fontSize = size + 'px';
// ??? move page view back near to original ???
}


TIA

Stefan
 

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
474,438
Messages
2,571,699
Members
48,796
Latest member
Greg L.
Top