/    Sign up×
Community /Pin to ProfileBookmark

opening search results in an iframe as opposed to a new page

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(“http://www.homestead.com/equishots/files/EQUISHOTS_HORSE_RACING_PHOTOGRAPHS.htm”,””,”Equishots Website”,”index,main,start,front”,”Equishots Index page.”);

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>

</code>
————————————————————

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[/url] (just click ‘buy photographs’ and it will take you to the page. Just search ‘grey abbey’ and you will see the new window appear.

<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

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @makka08 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...