Hi, I'm trying to use the following javascriptbased search engine on a site. It all works great when the search results have to appear in the frame that the form is calling from. But I want the form in the top frame (topFrame) to display the results in the bottom frame (mainFrame).
Before you say to use (Target="framename") in the Form tag, I already did. Doesn't seem to work. I'm sure it has something to do with the fact that I using an external javascript to return my search results.
Here the code I'm using:
In HTML Head
<script language="JavaScript1.3" type="text/javascript" src="findit_form.js"></scr
ipt>
In HTML Body
<form name="findit_Form" onSubmit="search_form(find
it_Form);r
eturn false">
<td bgcolor="#CCCCCC" align="center" width="186">
<input type="text" name="d" onFocus="if(this.value == 'Search')this.value = '';" onBlur="if(this.value == '')this.value = 'Search';" value="Search" size="16">
<input type="button" value="Go" onClick="search_form(findi
t_Form)" name="button">
</td>
</form>
Contents of External JS (findit_form.js)
// ---------- findit_form Start----------
var results_location = "results.html";
function search_form(findit_Form) {
if (findit_Form.d.value.lengt
h > 0) {
document.cookie = "d=" + escape(findit_Form.d.value
);
window.location = results_location;
}
}
// ---------- findit_form End ----------
There is another script tied into this mess, but it's presence in this question is irrelevant. It's only used to calculate the results to be displayed in the results.html page. Nothing to do with the location of the results.
As stated before, I tried adding a target to the Form tag in the HTML:
<form name="findit_Form" onSubmit="search_form(find
it_Form);r
eturn false" Target=mainframe>
Again, this script works beautifully when I use the form in the same frame that I want the results. But I want the form in the topFrame and the results in the mainFrame (on bottom).
Any ideas?
Start Free Trial