can u specify html as selected in the browser

J

jojoba

Hi all,

Just wondering if it's possible to specify specific html in the
document as selected?
I'm trying to find the position of html in a page, and if i can set
some html as selected, then i'm thinking i could then get the range
object and hence retrieve some pixel coordinates.

Anyone out there know this one?
thx,
jojoba
 
S

scripts.contact

Hi all,

Just wondering if it's possible to specify specific html in the
document as selected?
I'm trying to find the position of html in a page, and if i can set
some html as selected, then i'm thinking i could then get the range
object and hence retrieve some pixel coordinates.

var range=document.createRange();
range.selectNodeContents(document.getElementById('blah'))
getSelection().addRange(range)
 

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

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top