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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening in same page with Frames

Status
Not open for further replies.

thunderain

Programmer
Jan 10, 2002
40
CA
I hope someone can help me with this. I asked before but i think i didn't give the right info.

I have this working, a site search opening a separate window for results, but I have to have results displayed opening up in the same window in a page with three frames (top, side, main). results need to be displayed in main section titled "main information". ( have also tried "maiininformation", one word without space) I hope i am giving you enough info.

This code works to open results page in separate window, (works fine)

form code:


<form action=&quot;javascript:void(0)&quot; target=&quot;main information&quot; onSubmit=&quot;search(this); return false;&quot;>

<td height=&quot;29&quot; valign=&quot;top&quot; bgcolor=&quot;#000000&quot; width=&quot;118&quot;>
<div align=&quot;left&quot;>
<img src=&quot;images/search3.jpg&quot; width=&quot;90&quot; height=&quot;29&quot; border=&quot;0&quot;><input type=&quot;text&quot; name=&quot;srchval&quot; value=&quot;&quot; size=&quot;10&quot;> <input type=&quot;image&quot; img src=&quot;images/gobutt.jpg&quot; align=&quot;absmiddle&quot; width=&quot;30&quot; height=&quot;25&quot; border=&quot;0&quot;></div>
</td>

</form>

FUNTION:


page=&quot;<html><head><title>Search Results</title></head><body bgcolor='white'><center><table border=0 cellspacing=10 width=80%>&quot;;


function search(frm) {

win = window.open(&quot;&quot;,&quot;&quot;,&quot;scrollbars&quot;);

win.document.write(page);

txt = frm.srchval.value.split(&quot; &quot;);

fnd = new Array(); total=0;

for (i = 0; i < item.length; i++) {

fnd = 0; order = new Array(0, 4, 2, 3);

for (j = 0; j < order.length; j++)

for (k = 0; k < txt.length; k++)

if (item[order[j]].toLowerCase().indexOf(txt[k]) > -1 && txt[k] != &quot;&quot;)

fnd += (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(&quot;</table><br>Total found: &quot;+total+&quot;<br></body></html>&quot;);

win.document.close();

}

===============

I have tried several things. Is it as simple as changing a couple of lines, or do I need to send info to another page? Am I going at it wrong?

This is where i am now, but it does't return anything:


function search(frm) {


win = parent.frames[&quot;main information&quot;].location;

win.document.write(page);



txt = frm.srchval.value.split(&quot; &quot;);

ETC


OR


function search(frm) {


parent.frames[&quot;main information&quot;].location;

document.write(page);


txt = frm.srchval.value.split(&quot; &quot;);

ETC


Any help would be appreciated.

Thank you
thunderain.
 
Try this:

Assuming main page has frame named &quot;b&quot;.
<FRAME NAME=&quot;b&quot; SRC=&quot;b.htm&quot; SCROLLING=yes FRAMEBORDER=no MARGINHEIGHT=0 MARGINWIDTH=0 NORESIZE>

function changeFrame() {
var total = 100.00;
parent.b.document.open();
parent.b.document.write(&quot;<html><head><title>Search Results</title></head><body bgcolor='white'><center><table border=0 cellspacing=10 width=80%>&quot;);
parent.b.document.write(&quot;</table><br>Total found: &quot;+total+&quot;<br></body></html>&quot;);
parent.b.document.close();

}
 
Hi Thanx everyone, I got it working

1. Replaced these two lines:

win = window.open(&quot;&quot;,&quot;&quot;,&quot;scrollbars&quot;);
win.document.write(page);

With:

win = parent.frames[&quot;main information&quot;]
win.document.write(page)

2 Next, took out this line:

win.document.close();


It was a simple as that.
I could still use &quot;main information&quot; with the space as long as I had it in square brackets [&quot;main information&quot;].

thunderain
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top