Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Home Made search engine query

Status
Not open for further replies.

danfood

Programmer
Aug 8, 2001
32
0
0
GB
Hi there
I have a pretty crude search engine that I have made which searches an XML file and then displays abreviated information about each of the projects.

Once the results have appeared I want to allow the user to click on the result and it will take them to a page that displays all the data I have about the project.

Currently I am try to use a bit of a cheeky way of doing it by using the "this.InnerText" method to run the search engine again on just the project codes (ie. a unique identifier) but I cant get it to work.

Here is an abreviated version of the code.
It obviously doesn't like the JavaScript references in the
"output+=" section. But how do I get round this?

<script language=&quot;JavaScript&quot;>

function finddata(data)
{
toFind=''
var results=&quot;&quot;
var output= &quot;&quot;
count=0

if (data==1 && datasets.keyword.value >'' ) {
toFind= datasets.keyword.value.toUpperCase()
recordSet= sets.recordset;

while (!recordSet.EOF) {
var elementName= &quot;&quot;


elementProjclient += recordSet(&quot;PROJCLIENT&quot;)
elementName += recordSet(&quot;NAME&quot;)

elementName = elementName.toUpperCase()

if (elementName.indexOf(toFind) >=0) {
count+= 1
results+= &quot;<font class='id'>RESULT &quot;+ count + &quot;:</a></font><br />&quot;+ recordSet(&quot;NAME&quot;) + &quot;- <br />&quot;
results+= &quot;<b>Project Code:</b><a onClick='details(this.innerText)'>&quot;
+ recordSet(&quot;PROJCODE&quot;) + &quot;</a><br />&quot;
}

recordSet.moveNext()
}
}


output= &quot;<html><head><title>search results</title>&quot;
output+= &quot;<script language='JavaScript'> REPEAT SEARCH ENGINE CODE JUST ON PROJECT BASED ON THE THIS.INNERTEXT </script>&quot;
output+= &quot;</head>&quot;
output+= &quot;<body>&quot;
output+= &quot;<h3 class='title'> Your search for -&quot; + toFind + &quot; - produced &quot;+ count+ &quot; results. </h3><hr /> &quot;
output+= results

output+= &quot;<a href=projsearch.html> Search Again</a> </body></html>&quot;

newWindow= window.open(&quot;&quot;, target=&quot;_self&quot;)
newWindow.document.write(output)

}





</script>


</head>
<body>

Can anyone suggest a simple solution to this problem?
I'm not a master programmer hence the rather sledgehammer way of repeating the search.


Cheers
Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top