Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > JavaScript > Creating TextRa...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 35457 of 36378
Post > Topic >>

Creating TextRange from dom node's inner content

by "dino @[EMAIL PROTECTED] wrk" <dino@[EMAIL PROTECTED] > May 2, 2008 at 02:15 PM

is there a smooth way how to create an MS TextRange object which would 
contain only inner content of some
DOM node?

let's say i have a node looking like this...
<div id="myDiv">some text <b>inside</b> div element</div>

....and would like to create a range/textrange which would contain only:
"some text <b>inside</b> div element"


solving this using w3c implementation is rather easy, in which case range 
will only span over innerHTML of myDiv:

var range = do***ent.createRange();
range.selectNodeContents(reference_to_myDiv);


however, i'm not able to find the suitable solution for ms/ie 
implementation... msdn isn't really helpful either, since the only thing 
similar to abovewritten would be using method moveToElementText() of 
TextRange object, which again unfortunately returns the range spanned over

whole html of myDiv node, not just the innerHTML.


any suggestions?
 




 1 Posts in Topic:
Creating TextRange from dom node's inner content
"dino @[EMAIL PROTEC  2008-05-02 14:15:47 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 18:00:26 CDT 2008.