15.02.2013 Views

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

72 <strong>JavaScript</strong> <strong>Examples</strong> <strong>Bible</strong>: The Essential Companion to <strong>JavaScript</strong> <strong>Bible</strong><br />

Listing 15-27 (continued)<br />

document.body.scrollTop<br />

document.all.hiliter.style.pixelBottom = clientRects[n].bottom<br />

document.all.hiliter.style.pixelLeft = hLeft + document.body.scrollLeft<br />

document.all.hiliter.style.pixelWidth = hRight - hLeft<br />

document.all.hiliter.style.visibility = “visible”<br />

} else if (n > 0) {<br />

alert(“The content does not have that many lines.”)<br />

document.all.hiliter.style.visibility = “hidden”<br />

}<br />

}<br />

<br />

<br />

<br />

getClientRects() and getBoundClientRect() Methods<br />

<br />

<br />

Choose a line to highlight:<br />

<br />

<br />

1<br />

2<br />

3<br />

4<br />

5<br />

6<br />

7<br />

8<br />

9<br />

10<br />

11<br />

12<br />

13<br />

14<br />

15<br />

<br />

<br />

Full Width (bounding rectangle)<br />

<br />

<br />

Lorem ipsum dolor sit amet, consectetaur adipisicing elit, sed do<br />

eiusmod tempor incididunt ut labore et dolore magna aliqua.<br />

Ut enim adminim veniam, quis nostrud exercitation ullamco:<br />

<br />

laboris<br />

nisi<br />

aliquip ex ea commodo<br />

<br />

Duis aute irure dolor in reprehenderit involuptate velit esse<br />

cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat<br />

cupidatat non proident, sunt in culpa qui officia deseruntmollit<br />

elementObject.getBoundingClientRect()

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!