Click to See Complete Forum and Search --> : Position ON the page


Ritz
02-28-2003, 02:47 AM
A simple question, I think:

In the BODY of my HTML page I have long text.
Somewhere in the text I want to know how many pixels below the top of the page a certain sentence starts.

Like:
_______________________________
blablablalblablablabla
blablablalblabla
blablablalblablabla...bla
blablablalblablabla

<SCRIPT LANGUAGE="JavaScript">
var heightofsentence=???????;
</SCRIPT>

This is a certain sentence that starts somewhere halfway the page, but the more precise position is stored in a variable.
blablabla
blablablalblabla
blablablalblablablablablablablabla
blablablalblablabla!
_______________________________

I know what to substitute for the bla's, but can you tell me what to substitute for the question marks? Thanks!


P.S. Browsing on the net I found everthing about height and position of BODY or WINDOW, but not this simple thing.

Ritz
02-28-2003, 07:08 AM
Hi Dave,

Thank you for your quick respnse!

I tried it out on my page, but I get -1x-1 for the coordinate,
whereever the sentence is placed. What could be wrong?
I literally copied your code...