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

frames, form, come up in same page

Status
Not open for further replies.

thunderain

Programmer
Joined
Jan 10, 2002
Messages
40
Location
CA
Hi:

Can anyone help me. My opening page has three frames. When i type a number into the box and click on the Search button, I want the results to apear in the same page in the main body area (frame called "main information", page called "indexbody.html"). Instead the page opens in a new pop up window. I have looked over the FAQ's, they seem to tell me just to add an onClick to the button. I tried 3 examples which don't seem to work. Am I missing something?

onClick="parent.lower.location.href = 'indexbody.html;'
onClick="parent.main information.location.href='indexbody.html'"
onClick="parent.window.location.href="indexbody.html"'


Here is my 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; onClick=&quot;parent.main information.location.href='indexbody.html'&quot;></div>
</td>

</form>

Thank you
thunderain
 
could it be the space in ure frame name between main and information?
 
The frame name shouldn't have a space, so i fixed that.
I think the problem is in this function. I don't quite see how to get it pointing to a frame in the same page rather then opening a new window. Can anyone help?


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();


}



function show(which,wind,num) {

link = item[which][1] + item[which][0];

line = &quot;<tr><td><a href='&quot;+link+&quot;'>&quot;+item[which][2]+&quot;</a> Score: &quot;+num+&quot;<br>&quot;;

line += item[which][4] + &quot;<br>&quot;+link+&quot;</td></tr>&quot;;

wind.document.write(line);

return 1;

}


<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; onClick=&quot;parent.frames[&quot;main information&quot;].location = 'indexbody.html'&quot;></div>
</td>
</form>

Thank you
thunderain
 
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