Click to See Complete Forum and Search --> : a little problem with searching


vinsa
08-13-2003, 01:39 PM
Hello!
First sorry for my English.
This is my dictionary.
But i have problem with the searching.
The searching is not good.
When I type "april" or "APRIL" for keyword
-> there is no search result?
I must type "April" to find info
about "April". Can some help me
to edit the script, so that
the character case to have no matter
and when I type "april" -> Search result:
"here is the acceptation of April"

==================================
Here is the contents of the data file "MyDatabase.txt"
(First are the keywords, Last are the search results).
This is only example:
==================================

First;Last
accept;here is the acceptation of accept
account;here is the acceptation of account
April;here is the acceptation of April
May;here is the acceptation of May
mean;here is the acceptation of mean
means;here is the acceptation of means
meat;here is the acceptation of meat

==================================
Here is the script
==================================

<html>
<head>
<title>My Dictionary</title>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1251">
</head>
<body>
<!-- Data source object: file parameters -->
<object id="selectlist" width="0" height="0" classid="clsid:333C7BC4-460F-11D0-BC04-0080C7055A83">
<param name="DataURL" value="MyDatabase.txt">
<param name="FieldDelim" value=";">
<param name="UseHeader" value="true">
</object>


<h2>Searching in my DICTIONARY</h2>
<form name="SearchResults">
Query a key word: <input id="query" value="" /><button onclick="SearchAble()">search</button>
<button onclick="Clear();">Clear</button>
</form>
<script type="text/javascript">
<!--
page="<html><head><title>Search Results</title></head><body bgcolor='white' leftmargin=3 topmargin=3 text='blue'><center><table border=0 cellspacing=0 cellpadding=0 width=100%><font face=Arial size=3>";

function SearchAble() {
if (document.SearchResults.query.value == ""){
win = parent.middle("","secId5874","scrollbars=1");
win.document.write("write something");
win.document.close();
}
else{
SearchTable()
}
}

function SearchTable() {
win = parent.middle("","secId5874","scrollbars=1");
win.document.write(page);
selectlist.recordset.MoveFirst();
for (var i = 1; i <= selectlist.recordset.AbsolutePosition; i++) {
if(selectlist.recordset("first")==document.SearchResults.query.value) {
win.document.write(selectlist.recordset("last")+", ");
win.document.write("</font></table></body></html>");
win.document.close();
}
selectlist.recordset.MoveNext();
}

}

function Clear() {
win = parent.middle("","secId5874","scrollbars=1");
win.document.write(page);
win.document.close();
document.SearchResults.query.value = "";
}
//-->
</script>


<IFRAME name="middle" width="250" height="300" src="nach.html" frameborder=0 style="border-style: inset; border-width: 2px"></IFRAME>

</body>
</html>

David Harrison
08-13-2003, 02:07 PM
This should work but I'm only about 75% sure, change this line:

if(selectlist.recordset("first")==document.SearchResults.query.value) {

into this:

if(selectlist.recordset("first").toLowerCase()==document.SearchResults.query.value.toLowerCase()) {

This changes everything that the user entered into lower case and checks to see if the thing in the database matches it when that is changed to lower case.

vinsa
08-13-2003, 04:20 PM
lavalamp I try this but it not work.
Somebody to have another ideas?

David Harrison
08-13-2003, 05:07 PM
Well I think the best way of solving this problem would be to input items into the database in lower case and then change the line of script mentioned before to this:

if(selectlist.recordset("first")==document.SearchResults.query.value.toLowerCase()) {

vinsa
08-14-2003, 03:44 AM
I try this, but it not work too.

vinsa
08-14-2003, 07:51 AM
Poeple help me.
Here are the best javascript experts
like Dave Clark, Charles, Fang, Khalid Ali, pyro.
I think that my progblem is not so serious
but I am begginer javacript proggramer
and just can't fixed.