Apr 3, 2002 #1 dizi Programmer Apr 3, 2002 4 US How do i select a portion of text in a textarea? thanks.
Apr 3, 2002 1 #2 dianal Instructor Mar 7, 2001 273 BG Try this example - works only in IE5 and above: Name of methods are case sensitive. Check MSDN for additional info. <html> <head> <title> Tetxarea select </title> <SCRIPT LANGUAGE="JScript"> function sel() { var rng = document.sForm.sArea.createTextRange(); if (rng!=null) { b = rng.findText("me" //returns true or false if (b) { rng.select() } } } </SCRIPT> </head> <body onLoad="sel()"> <h2>Text</h2> <form name="sForm"> <textarea name="sArea">Test me here</textarea> </form> </body> </html> Upvote 0 Downvote
Try this example - works only in IE5 and above: Name of methods are case sensitive. Check MSDN for additional info. <html> <head> <title> Tetxarea select </title> <SCRIPT LANGUAGE="JScript"> function sel() { var rng = document.sForm.sArea.createTextRange(); if (rng!=null) { b = rng.findText("me" //returns true or false if (b) { rng.select() } } } </SCRIPT> </head> <body onLoad="sel()"> <h2>Text</h2> <form name="sForm"> <textarea name="sArea">Test me here</textarea> </form> </body> </html>
Apr 3, 2002 Thread starter #3 dizi Programmer Apr 3, 2002 4 US Excellent! Thanks alot. Upvote 0 Downvote
Dec 5, 2002 #4 aravindb Programmer Sep 23, 2002 6 MY hi dianal, this is what i exactly wanted. Perfect !!! Upvote 0 Downvote
Dec 5, 2002 #5 Tarwn Programmer Mar 20, 2001 5,787 US Nice piece of information to have, good post --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- http://www.tuxedo.org/~esr/faqs/smart-questions.html Upvote 0 Downvote
Nice piece of information to have, good post --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- http://www.tuxedo.org/~esr/faqs/smart-questions.html