"Henri" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> <HTML>
> <HEAD></HEAD>
> <BODY><p>pippo1</p><p>pippo2</p><p>pippo3</p></BODY>
> <SCRIPT language="JavaScript">
> var sel = window.getSelection();
> sel.collapse( document.body, 0 );
> sel.extend( document.body, 3 );
> </SCRIPT>
> </HTML>
> 
> This will work only if there are no spaces between tags, or you will have to
> count spaces/new lines text nodes too:
> 
> <HTML>
> <HEAD></HEAD>
> <BODY>0 -- this new line is a text node  -- 1
> 1<p>pippo1</p>2 -- this new line is a text node -- 3
> 3<p>pippo2</p>4 -- this new line is a text node -- 5
> 5<p>pippo3</p>6 -- this new line is a text node -- 7
> </BODY>
> <SCRIPT language="JavaScript">
> var sel = window.getSelection();
> sel.collapse( document.body, 0 );
> sel.extend( document.body, 6 );
> </SCRIPT>
> </HTML>
> 
> will work also.
> 
> Henri
> 
> "Stefano" <[EMAIL PROTECTED]> a �crit dans le message de

Ok Henry i have another question.
If i have this situation

<p>pippo (<b>pippo1 ciao</b>) ciao1</p> 

and i have selected from all element b
()= selected zone

so when i replace this node with <h2>pippo <b>pippo1 ciao</b>
ciao1</h2> i have lost the selection and the focus.

i don't understand how i obtain again same selection and set new focus
in new node



Thanks Stefano
_______________________________________________
mozilla-editor mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-editor

Reply via email to