Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Move Search Results into a Frame

Status
Not open for further replies.

Killborg

Technical User
Jul 16, 2007
46
US
Hello,
I have a script that opens a window and displays
the results of the search.

My page now has frames.

What I need to do now is open the results into
a frame. The main frame is named "ContentFrame" and
the frame I need the results to show in is named
"NavFrame"

Having trouble, where in the code do I make the
change to make the results show into the frame.


function FindPic() { // Search for a image.
TotalFound = 0;
SearchString = document.CutbookForm.SearchWord.value;
SearchString = SearchString.toLowerCase();
WriteResults = window.open("","resultwindow","height=600, width=275, toolbar=0, status=0, menubar=0, resizable=1, scrollbars=1");
WriteResults.document.open();
WriteResults.document.write('<style type=text/css>body{background:url(); font:13pt verdana}'
+ 'a{text-decoration:none}'
+ 'img{border:2px ridge #ffaaaa; height:70px; vertical-align:middle}'
+ '</style>'
+ 'You searched for: <i>' + SearchString + '</i>'
+ '<br>Category: <i>' + parent.document.CutbookForm.CategoryDropdown.options.value + '</i>'
+ '<p><b>Results:</b><br>');
for (loop=0; loop < ActiveVar ; loop++) {
Keyword = CutArray[loop].TxtVal;
Keyword = Keyword.toLowerCase();
URL = CutArray[loop].PicVal;
title = CutArray[loop].TitVal;
title = title.toUpperCase();//Changes letters in the results window.
SearchResult = Keyword.indexOf(SearchString);
SearchResult2 = title.indexOf(SearchString);
if (SearchResult != "-1" || SearchResult2 != "-1") {
WriteResults.document.write('<p><a href=javascript:ShowCutPic(' + loop + '); target="main"><img src=' + CutArray[loop].PicVal + '></a> ' + title);
TotalFound++;
}
}
WriteResults.document.write('<p><b>Returned ' + TotalFound + ' results.</b><p><a href="javascript:window.close();">close window</a>');
WriteResults.document.close();
}
 
It looks like you're running "FindPic" on the submission of a form, in which case you're better off simply submitting your form into the frame and not calling "FindPic":

Code:
<form ... target="NavFrame" ...>

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Thank You for the information.

Hope this is correct.

On the NavFrame I Created a form:
<form id="NavForm" name="NavForm" action="">
</form>

The submit button code:
<input name="Search" type="submit" id="Search" style="font:8pt verdana" onClick="javascript:FindPic();" value="Search">

On the ContentFrame I changed the information:
<form name="CutbookForm" target="NavFrame" "NavForm">

When I select submit the form in the ContentFrame
is displayed in the NavFrame not the search results.
And if I click again the form in the content frame
opens a window and displays the form.

I am getting close but certain things still
confuse me because I am still new to this.
 
Where is "ActiveVar" defined? Perhaps for a search results page, using a server-side process to output the search results would be a better option than using client-side JS (after all, how can client-side JS reliably index any content on a server?).

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Hi

Anyway, remove the pseudo-protocol from the event handler call :
Code:
<input name="Search" type="submit" id="Search" style="font:8pt verdana" onClick="[s][red]javascript:[/red][/s]FindPic();" value="Search">


Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top