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="JavaScript">
function finddata(data)
{
toFind=''
var results=""
var output= ""
count=0
if (data==1 && datasets.keyword.value >'' ) {
toFind= datasets.keyword.value.toUpperCase()
recordSet= sets.recordset;
while (!recordSet.EOF) {
var elementName= ""
elementProjclient += recordSet("PROJCLIENT"
elementName += recordSet("NAME"
elementName = elementName.toUpperCase()
if (elementName.indexOf(toFind) >=0) {
count+= 1
results+= "<font class='id'>RESULT "+ count + ":</a></font><br />"+ recordSet("NAME" + "- <br />"
results+= "<b>Project Code:</b><a onClick='details(this.innerText)'>"
+ recordSet("PROJCODE" + "</a><br />"
}
recordSet.moveNext()
}
}
output= "<html><head><title>search results</title>"
output+= "<script language='JavaScript'> REPEAT SEARCH ENGINE CODE JUST ON PROJECT BASED ON THE THIS.INNERTEXT </script>"
output+= "</head>"
output+= "<body>"
output+= "<h3 class='title'> Your search for -" + toFind + " - produced "+ count+ " results. </h3><hr /> "
output+= results
output+= "<a href=projsearch.html> Search Again</a> </body></html>"
newWindow= window.open("", target="_self"
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
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="JavaScript">
function finddata(data)
{
toFind=''
var results=""
var output= ""
count=0
if (data==1 && datasets.keyword.value >'' ) {
toFind= datasets.keyword.value.toUpperCase()
recordSet= sets.recordset;
while (!recordSet.EOF) {
var elementName= ""
elementProjclient += recordSet("PROJCLIENT"
elementName += recordSet("NAME"
elementName = elementName.toUpperCase()
if (elementName.indexOf(toFind) >=0) {
count+= 1
results+= "<font class='id'>RESULT "+ count + ":</a></font><br />"+ recordSet("NAME" + "- <br />"
results+= "<b>Project Code:</b><a onClick='details(this.innerText)'>"
+ recordSet("PROJCODE" + "</a><br />"
}
recordSet.moveNext()
}
}
output= "<html><head><title>search results</title>"
output+= "<script language='JavaScript'> REPEAT SEARCH ENGINE CODE JUST ON PROJECT BASED ON THE THIS.INNERTEXT </script>"
output+= "</head>"
output+= "<body>"
output+= "<h3 class='title'> Your search for -" + toFind + " - produced "+ count+ " results. </h3><hr /> "
output+= results
output+= "<a href=projsearch.html> Search Again</a> </body></html>"
newWindow= window.open("", target="_self"
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