Hi,
If I select some text with mouse in a webpage, how can I know what I selected? For example, if i select this text now and I press B(old) this text is surrounded by [ B ] [ /B ]. How can I achieve this?
| SitePoint Sponsor |

Hi,
If I select some text with mouse in a webpage, how can I know what I selected? For example, if i select this text now and I press B(old) this text is surrounded by [ B ] [ /B ]. How can I achieve this?
Look here:
http://www.massless.org/mozedit/
http://www.webreference.com/js/colum...ssbrowser.html
Combine these two and learn DOM.
bosko, the code shown in the second page you linked to doesn't work for text in a textarea.
Here are some more resources:
How can I manipulate the selection and the caret in an input type="text" element in Mozilla browsers and IE/Win?
http://www.alexking.org/blog/2003/06...ng-javascript/
http://parentnode.org/javascript/wor...rsor-position/
We miss you, Dan Schulz.
Learn CSS. | X/HTML Validator | CSS validator
Dynamic Site Solutions
Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.
I'm not saying that it can't be useful at all. I'm just saying that it doesn't work in one common situation.
We miss you, Dan Schulz.
Learn CSS. | X/HTML Validator | CSS validator
Dynamic Site Solutions
Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

Thanks guys!
Putting together all the informations comes out exactly what I needed.
Bookmarks