Hi Gang!
I'm learning some JavaScript iun a class and I have a search engine running a search on a JS file with 40 listings. The files I have are from a very old book, I bet some of you know it...the "JavaScript Application Cookbook." I'm trying to modify the JS and HTML pages to make the search be case sensitive. I have inserted a checkbox which is suppose to change the value of the function which controls if the search should be case-sensitive or not. So far, I have not been able to get it to work. It continues to come back as being case INsensitive. I could use some help if you please to get this to work.
I have tried several things recommended to me by my instructor, but nothing he has done has worked. We have enabled the console logger of Firebug to show the values for our functions and variables.
Here is some of the JS code which controls the search:
here is the HTML file which contains the checkboxCode:var CASE_SENSITIVE = false; // ***** ***** controls case-sensitive search across functions var HTTP_RE = /\|[Hh][Tt][Tt][Pp]/; // ** regular expression object, for '|http' searching var CASE = false; var NOCASE = true; ___________________________________________________________________ // Determine the type of search, and make // sure the user has entered something function validate(entry, isSensitive) { // ** nocase added, to enable/disable case-sensitive search consoleLog("validate(\n\n=>" + entry + "\n\n" + isSensitive + " called."); // ***** CASE_SENSITIVE = (isSensitive == "false" ? CASE : NOCASE);
Any help you can provide to get this to work will be acknowledged.HTML Code:<HTML> <HEAD> <TITLE>Search Nav Page</TITLE> <SCRIPT LANGUAGE="JavaScript1.1" SRC="records.js"></SCRIPT> <SCRIPT LANGUAGE="JavaScript1.1" SRC="nav2.js"></SCRIPT> </HEAD> <BODY BGCOLOR="WHITE"> <TABLE WIDTH="95%" BORDER="0" ALIGN="CENTER"> <TR> <TD VALIGN=MIDDLE> <FONT FACE="Arial"> <B>Client-Side Search Engine</B> </TD> <TD VALIGN=ABSMIDDLE> <FORM NAME="search" onSubmit="validate(document.forms[0].query.value,NOCASE); return false;"> <INPUT TYPE=TEXT NAME="query" SIZE="33"> <INPUT TYPE="checkbox" name="case" id="case" value="1"><LABEL FOR="case"> Case-Sensitive search</LABEL> </FORM> </TD> <TD VALIGN=ABSMIDDLE> <B><A HREF="main.html" TARGET="main">Help</A></B> </TD> </TR> </TABLE> </BODY> </HTML>
Thanks!


Reply With Quote

Bookmarks