Nandhini
asked on
Textarea - highlighting keywords
hi all,
i am trying to hightlight certain words in <textarea>
so i have decided to change the color of those words(key words) in <textarea>
let me be more clear
i am trying to search the contents of <textarea> for some words and highlight them
the soln is very urgent
thanks in advance
i am trying to hightlight certain words in <textarea>
so i have decided to change the color of those words(key words) in <textarea>
let me be more clear
i am trying to search the contents of <textarea> for some words and highlight them
the soln is very urgent
thanks in advance
ASKER
hi rajeev,
i need a sample program
i need a sample program
Check this
It took quite a time
-------------------------- -
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<script language="JavaScript">
function searchText(replaceText,byT ext)
{
var regEx = new RegExp(byText.value);
var regEx=regEx.compile(byText .value, "gi")
replaceText.innerHTML=(rep laceText.i nnerHTML.r eplace(reg Ex,"<font color='#0000FF'>"+byText.v alue+"</fo nt>"));
}
</script>
<body onLoad="document.form1.tex t1.select( );">
<form action="" method="post" name="form1">
<p> <strong>A quick brown fox jumps over a lazy dog</strong></p>
<p>
<input name="text1" type="text" id="text1" value="quick">
<input type="button" name="Button" value="Search" onClick="searchText(textPa ra,text1); ">
</p>
</form>
</body>
</html>
Regards
Rajeev
It took quite a time
--------------------------
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<script language="JavaScript">
function searchText(replaceText,byT
{
var regEx = new RegExp(byText.value);
var regEx=regEx.compile(byText
replaceText.innerHTML=(rep
}
</script>
<body onLoad="document.form1.tex
<form action="" method="post" name="form1">
<p> <strong>A quick brown fox jumps over a lazy dog</strong></p>
<p>
<input name="text1" type="text" id="text1" value="quick">
<input type="button" name="Button" value="Search" onClick="searchText(textPa
</p>
</form>
</body>
</html>
Regards
Rajeev
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
hi rajeev!
ur program highlights the text in the document but not in textarea
but this is not my intention
any way thanks!
ur program highlights the text in the document but not in textarea
but this is not my intention
any way thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi Nandhini
you have asked the same question twice
and have even requested to close one of the listed beneath
and the answer is same YOU CANT DO THAT
Q_20970138.html Q_20970188.html
Rajeev
you have asked the same question twice
and have even requested to close one of the listed beneath
and the answer is same YOU CANT DO THAT
Q_20970138.html Q_20970188.html
Rajeev
Regards
Rajeev