Hi guys,
I’ve been using this search engine on my website for a while now, but it’s been increasingly annoying that all the search results are loaded into a new html window.
Does anyone have any idea how I can change this so that the results open inside an iframe window instead? Then I can keep everything within the same page. The code below is the head section; I’ve included the code that makes the search box and button below it.
Basically you add a new line (// “Page Name”,”path” “,”Page Title”,”Key Words”,”Descriptive Comments”
) for each page – (starting with c=0?. The example here is our homepage.
<code><SCRIPT LANGUAGE=”JavaScript”>
<!– Begin
var item = new Array();
/* Here is where all the magic happens.
Just enter as many additional pages that
that you want to search, then fill in the
additional listings for each page.
// “Page Name”,”path” “,”Page Title”,”Many,Key,Words”,”Descriptive Comments”
c=0; item[c]=new Array(“
page=”<html><bgcolor=’white’><center><table border=0 cellspacing=10 width=80%>”;
function search(frm) {
win = window.open(“”,””,”scrollbars, width=1270,height=700,left = 0,top = 0″);
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(“</table><br>Total found: “+total+”<br></body></html>”);
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> Score: “+num+”<br>”;
line += item[which][4] + “<br>”+link+”</td></tr>”;
wind.document.write(line);
return 1;
}
// End –>
</script>
search button/box code – goes into the body wherever you want it to appear. The code and engine is viewable here: [url]www.equishots.co.uk
<code><form method=get action=”javascript:void(0)” onsubmit=”search(this); return false;”>
<p align=”center”><br>
<input type=text name=srchval value=”” size=”20″ style=”color: #000000; font-family: Arial; font-size: 10pt; background-color: #FFFFFF; border: 1 solid #000000″> <input type=submit value=”Search” style=”background-color: #000000; color: #FFFFFF; font-family: Arial; font-weight: bold”><font size=”1″ face=”Arial”><br>
<font color=”#000028″>Please don’t use capitals!</font></font>
</form></code>
Thanks in advance. I’ve tried to make it easy to understand lol…and in doing so have probably made it harder! E-mail me if you need to know more.
I’ve tried a shed-load of things but I just keep getting errors. It’s my first so sorry if I’ve screwed up somehow in posting.
Makka