bacterozoid
10-26-2002, 03:04 AM
Here is the script (The basic of it anyways):
<!-- Begin
var item = new Array();
// "Page Name","path","Page Title","Many,Key,Words","Descriptive Comments"
c=0; item[c]=new Array("a","b","c","d","e");
c++; item[c]=new Array("a","b","c","d","e");
page="contents of page here";
function search(frm) {
win = window.open("","","scrollbars");
win.document.write(page);
txt = frm.srchval.value.split(" ");
fnd = new Array(); total=0;
for (i = 0; i < item.length; i++) {
fnd[i] = 0; order = new Array(0, 4, 2, 3);
for (j = 0; j < order.length; j++)
for (k = 0; k < txt.length; k++)
if (item[i][order[j]].toLowerCase().indexOf(txt[k]) > -1 && txt[k] != "")
fnd[i] += (j+1);
}
for (i = 0; i < fnd.length; i++) {
n = 0; w = -1;
for (j = 0;j < fnd.length; j++)
if (fnd[j] > n) { n = fnd[j]; w = j; };
if (w > -1) total += show(w, win, n);
fnd[w] = 0;
}
win.document.write("what to write at the bottom of the page");
win.document.close();
}
function show(which,wind,num) {
link = item[which][1] + item[which][0];
line = "<tr><td><a href='"+link+"'>"+item[which][2]+"</a> Relevance: "+num+"<br>";
line += item[which][4] + "<br><!--"+link+"--><br><hr width=\"70%\" size=\"1\" color=\"#535353\"><br></td></tr>";
wind.document.write(line);
return 1;
}
// End -->
Ok, what I have there is what is processed when you click a button submitting a search form. I have bolded the parts I feel relevent to change using the innerHTML property.
If you go here: http://www21.brinkster.com/jonshtmlhelp/ you see the search box on the left side of the screen. (It works as of right now) I want the search results to replace the entire contents of the cell containing the main information (called 'results') I know it can be done, but I have only accomplished it on a simpler level.
The script is loading from an external .js file, which is why there are the extra slashes and such.
I would greately appreciate any form of help I could recieve here. I continue to dink with the code myself, but I am not entirely sure how to do it.
<!-- Begin
var item = new Array();
// "Page Name","path","Page Title","Many,Key,Words","Descriptive Comments"
c=0; item[c]=new Array("a","b","c","d","e");
c++; item[c]=new Array("a","b","c","d","e");
page="contents of page here";
function search(frm) {
win = window.open("","","scrollbars");
win.document.write(page);
txt = frm.srchval.value.split(" ");
fnd = new Array(); total=0;
for (i = 0; i < item.length; i++) {
fnd[i] = 0; order = new Array(0, 4, 2, 3);
for (j = 0; j < order.length; j++)
for (k = 0; k < txt.length; k++)
if (item[i][order[j]].toLowerCase().indexOf(txt[k]) > -1 && txt[k] != "")
fnd[i] += (j+1);
}
for (i = 0; i < fnd.length; i++) {
n = 0; w = -1;
for (j = 0;j < fnd.length; j++)
if (fnd[j] > n) { n = fnd[j]; w = j; };
if (w > -1) total += show(w, win, n);
fnd[w] = 0;
}
win.document.write("what to write at the bottom of the page");
win.document.close();
}
function show(which,wind,num) {
link = item[which][1] + item[which][0];
line = "<tr><td><a href='"+link+"'>"+item[which][2]+"</a> Relevance: "+num+"<br>";
line += item[which][4] + "<br><!--"+link+"--><br><hr width=\"70%\" size=\"1\" color=\"#535353\"><br></td></tr>";
wind.document.write(line);
return 1;
}
// End -->
Ok, what I have there is what is processed when you click a button submitting a search form. I have bolded the parts I feel relevent to change using the innerHTML property.
If you go here: http://www21.brinkster.com/jonshtmlhelp/ you see the search box on the left side of the screen. (It works as of right now) I want the search results to replace the entire contents of the cell containing the main information (called 'results') I know it can be done, but I have only accomplished it on a simpler level.
The script is loading from an external .js file, which is why there are the extra slashes and such.
I would greately appreciate any form of help I could recieve here. I continue to dink with the code myself, but I am not entirely sure how to do it.