Search in Textarea only....Script..needed

wxdqz

New Member
Hi
as you can see this is a search in page script
but , i want to know if it can be re-edited so
that when I look for a word or letter the script would only search
in the Textarea only not out side of it




<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var NS4 = (document.layers);var IE4 = (document.all);var win = this;var n = 0;
function findInPage(str) {var txt, i, found;if (str == "")return false;if (NS4) {
if (!win.find(str))while(win.find(str, false, true))n++;elsen++;
if (n == 0) alert(str + " was not found on this page.");}if (IE4) {
txt = win.document.body.createTextRange();for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {txt.moveStart("character", 1);txt.moveEnd("textedit");}if (found) {
txt.moveStart("character", -1);txt.findText(str);txt.select();txt.scrollIntoView();n++;
}else {if (n > 0) {n = 0;findInPage(str);}else
alert(str + " was not found on this page.");}}return false;}
// End -->
</script>
</HEAD>

<BODY>






<form name=search>
Find in Page
<input name=string type=text size=15 onChange="n = 0;">
<input type=button value=http://www.webdeveloper.com/forum/archive/index.php/"Search"
onClick="findInPage(this.form.string.value);">
</form>




<form NAME="copy">


<textarea NAME="txt" ROWS=5 COLS=25 WRAP=VIRTUAL>
one two three four</textarea>
</form>

one two three four
 
Back
Top