[
Lists Home |
Date Index |
Thread Index
]
Hello, Each record in my database has one summary field
and up to three subject fields. The search function
below will return results from the summary field and
the first subject field only. Is there an adjustment
I can make so that all three subject fields are
searched?
Regards, Michele
--------------------
function search(searchStr, searchType)
{
var pattern = /(\w)(\w*)/;
var a = searchStr.split(/\s+/g);
for (i = 0 ; i < a.length ; i ++ ) {
var parts = a[i].match(pattern);
var firstLetter = parts[1].toUpperCase();
var restOfWord = parts[2].toLowerCase();
a[i] = firstLetter + restOfWord;
}
searchStr = a.join(' ');
var docRoot = dbDocument.documentElement;
if (docRoot == null)
alert("Document is null");
else
{
products = docRoot.selectNodes("/images/image");
for (i = 0; i < products.length; i++)
{
if (searchType[0].checked)
{
prod =
docRoot.selectNodes("/images/image/summary").item(i);
}
else if (searchType[1].checked)
{
prod =
docRoot.selectNodes("/images/image/subject").item(i);
}
if ( prod.text.search(searchStr) != -1)
{
var cloneTree =
docRoot.selectNodes("/images/image").item(i).cloneNode(true);
resultSet.documentElement.insertBefore(cloneTree,
resultSet.documentElement.firstChild);
}
}
}
________________________________________________
PeoplePC: It's for people. And it's just smart.
http://www.peoplepc.com
|