|
|
Home » Javascript » Article
Javascript Get Selected Text
|
| Article by: | Jeff Anderson (9/1/2006) |
|
| Summary: | A cross-browser script to get text selected by the user |
|
| Viewed: 164084 times |
Rating (1559 votes): |
|
1.1 out of 5 |
|
|
|
View highlighted Comments
User Comments on 'Javascript Get Selected Text'
|
Posted by :
kato at 06:13 on Thursday, October 12, 2006
|
Cool and easy to get selected text but wait...
What about getting the [b]position[/b] of the selection in the whole string (indexOf)?
If I select "The methods of handling this" on this page, I'll be ok.
If I select "this", I will get the index of the first occurence of "this" on this page : the one from "Rate this article" at the top.
Any idea?
| |
Posted by :
ayappa at 01:44 on Wednesday, January 10, 2007
|
I have an html page. I select some portion of text on this page with the mouse. I want to introduce start and end tags at the beginning and end of the selected area of text.
I wish to name these tags as <one> and </one> and insert them in the html file at the respective positions.
I shall do this for several selections.
I shall then parse this html file for these tag names to identify the selected text and store the names in a table for future use.
Please help me with javascript or vbscript code to achieve the same.
Thanks
| |
Posted by :
LOGANAYAKI at 04:46 on Sunday, March 04, 2007
|
Hi,
Please send codings to create login page with JSP and mySQL
| |
Posted by :
hamedsabzian at 05:42 on Sunday, May 11, 2008
|
Hi;
Tank you for this useful post;
| |
Posted by :
manish6789 at 01:31 on Wednesday, June 11, 2008
|
hi
i have a web page i wanna open this by using username and password for which i need html coding. i m mentioning the name of web page which is as follow. "admin.html"
| |
Posted by :
PhaniReddy at 02:56 on Tuesday, July 29, 2008
|
how to know the status of parent window from being on the child window..wheather parent window closed or not..
| |
Posted by :
PhaniReddy at 02:56 on Tuesday, July 29, 2008
|
how to a field name from java script when document is in rea mode?
| |
|
To post comments you need to become a member. If you are already a member, please log in .
| RELATED ARTICLES |
Javascript - Enable and Disable form elements by Jeff Anderson
This is a relatively little known and under-used feature of javascript which can be very useful in guiding a user through a form. Using the disabled tag, you can switch on and off elements in a form. |
 |
Check IsNumeric Function by Jeff Anderson
A javascript validation function to check whether the details entered by a user are numeric. |
 |
Javascript Onload Event by Jeff Anderson
Sometimes you need to perform an action immediatley after the page has loaded. That's when the onLoad Event Handler comes in handy |
 |
Form Validation Function by Jeff Anderson
A javascript validation function that you can use to validate all types of forms. |
 |
JavaScript Field Is Empty Form Validation by Jeff Anderson
This javascript function allows you to check whether a form field has been completed or not. |
 |
Javascript Get Selected Text by Jeff Anderson
A cross-browser script to get text selected by the user |
 |
Check Email Validation Function by Jeff Anderson
A javascript validation function to check whether the user has entered a valid email address in a form. |
 |
Multiple submit buttons on a single form by Kiran Pai
This script shows you how to submit the contents of a form to different programs depending on which Submit button you press. Additionally it also shows how to call two different functions when you press the Submit button. |
 |
Validate Form and Disable Submit Button by Marylou Marks
I have a form that validates info, but I also want to disable the submit button. The disable part worked before adding the form validating. |
 |
Javascript onUnload Event Handler by Jeff Anderson
The onUnload Event Handler allows you to perform an action as the user leaves the page. |
 |
| |