¡@

Home 

2014/10/16 ¤W¤È 12:10:46

jquery Programming Glossary: zallnodes

Select text and then calculate its distance from top with Javascript?

http://stackoverflow.com/questions/3170902/select-text-and-then-calculate-its-distance-from-top-with-javascript

SearchStr #idSearchStr 0 .value Ignore empty or trivial searches. if SearchStr ^ s .test SearchStr return false var zAllnodes body var iNumNodes zAllnodes.length var zRegEx new RegExp ' ' SearchStr ' ' 'ig' var bFoundOne false Look for string and.. Ignore empty or trivial searches. if SearchStr ^ s .test SearchStr return false var zAllnodes body var iNumNodes zAllnodes.length var zRegEx new RegExp ' ' SearchStr ' ' 'ig' var bFoundOne false Look for string and wrap it in a span if found... We do NOT want to use innerHTML here. We do not want to mess with matches in HTML tags for now. var zNode zAllnodes J var sNodeTxt zAllnodes J .innerText zAllnodes J .textContent if zRegEx.test sNodeTxt var OldStr zAllnodes J .innerHTML..