I managed to write a script that retrieves results from a database and places it within a DIV as a user types in a search box. My problem is I'm attempting to run a javascript code that takes the results from the database and then BOLDs the value within the results that match the value in the search box.


AJAX page code:
Code:
<table bgcolor="green">
	<asp:Repeater ID="rptResults" runat="server">
		<ItemTemplate>
			<tr><td style="background-color:yellow;"><%# DataBinder.Eval(Container.DataItem, "title") %>



				<script type="text/javascript">
					var str = "<%# DataBinder.Eval(Container.DataItem, "title") %>";
					var strlc = str.toLowerCase();
					var qstr = "<% response.write(request.querystring("q")) %>";
					var lstr = str.slice(0,str.indexOf(qstr));

					var indexOfEnd = strlc.indexOf(qstr.toLowerCase());
					var indexOfBegin = 0;
					
					document.write(str.slice(indexOfBegin,indexOfEnd));
					
					indexOfBegin = indexOfEnd;
					
					if (indexOfBegin==0)
					{
						indexOfEnd = qstr.length;
					}
					else
					{
						indexOfEnd = lstr.length + qstr.length;
					}

					document.write(str.slice(indexOfBegin,indexOfEnd).bold());


					indexOfBegin = indexOfEnd;
					indexOfEnd = str.length;

					document.write(str.slice(indexOfBegin,indexOfEnd));
				</script>



			</tr></td>
		</itemtemplate>
	</asp:Repeater>	
</table>
The code above shows the portion in which data is taken from the database and placed within a repeater. i want to take those results and alter them with javascript to bold the area that matches.

finance.google.com already does this, and that's basically exactly what I want to create.

I got everything else working correctly besides running that code, since AJAX will only show the resutls as pure code, and not as the actual results.

Any clues?