...

View Full Version : can't open target page in separate frame



Beck1
04-30-2004, 03:11 PM
Hi
Would someone be able to help me please? I'm trying to get the new page that this script brings up to load in another frame called "middle", rather than in the same frame, but I can't see how to do it.
Would be very grateful for any help.
Thanks
Beck

<HTML>
<HEAD>
<TITLE>Candidates</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--- Hide from tired old browsers that should be put to pasture.

////////////////////////////////////////////////////////////////////
/// Get your very own Gate Keeper from Professional Web Design ///
/// http://junior.apk.net/~jbarta/weblinks/gate_keeper/ ///
////////////////////////////////////////////////////////////////////

function goForit() {
var location;
var password;
password=this.document.testform.inputbox.value
location=password + ".html"
fetch(location)
theKeeper=window.close()
}

function fetch(location) {
var root;
if (opener.closed) {
root=window.open('','theKeepersGopher','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=y es,resizable=yes,copyhistory=no');
root.location.href = location;
} else {
opener.location.href = location;
}
}

// End hiding --->
</SCRIPT>
<style type="text/css">
<!--
.body { font-family: Arial, Helvetica, sans-serif; font-size: 10pt; color: 333399}
-->
</style>
</HEAD>

<BODY bgcolor="#FFFFFF">
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
<TR valign="top">
<TD ROWSPAN=2 WIDTH=50%><img src="images/logo.gif">
<TD WIDTH=50% ALIGN=CENTER> <FONT FACE="ARIAL" SIZE=2><span class="body">This
section is password protected. Please enter the password you have been provided.</span></FONT>
<TR>
<TD WIDTH=50% ALIGN=CENTER>
<CENTER>
<p>&nbsp;</p><FORM NAME="testform">
<p>
<INPUT TYPE="text" NAME="inputbox" VALUE="" size=20>
</p>
<p>
<INPUT TYPE="button" NAME="button" Value="Submit Password" onClick="goForit(this.form)">
</p>
</FORM>
</CENTER>


</TABLE>

</BODY>

</HTML>

jalarie
04-30-2004, 05:32 PM
Change the following:

if (opener.closed) {
root=window.open('','theKeepersGopher','toolbar=yes,location=y
es,status=yes,menubar=yes,scrollbars=yes,resizable =yes,copyhistory=no');
root.location.href = location;
} else {
opener.location.href = location;
}

to:

window.frames['middle'].location=location;

Beck1
05-01-2004, 11:35 AM
Hi
This doesn't seem to work - no page is loaded anywhere - I think it may be looking for a frame called 'middle' within the pop-up window that contains this script - rather than the root opener window.
I need to somehow target a frame within the opener window. Any ideas?

Thanks
Beck

llizard
05-01-2004, 01:03 PM
I'm a rank beginner at Javascripting, so you experts, don't shoot me down....

Beck, I'm wondering if you could do something along this line:


function opensetAttribute(){
('target','middle');
}

Of course, you probably have to add "root" somewhere there to get the browser to look for the middle frame on the root rather than opening yet another window.

I hope that helps rather than hinders.

Beck1
05-01-2004, 05:31 PM
Thanks it gave me a few ideas to try - none of which have worked...
Any other advice out there?

Thanks
Beck

Beck1
05-02-2004, 01:36 PM
Got it - yay!

function fetch(location) {
var root;
if (opener.closed) {
root=window.open('','theKeepersGopher','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=y es,resizable=yes,copyhistory=no');
root.location.href = location;
} else {
opener.parent.middle.location.href = location;
}
}

glenngv
05-03-2004, 04:39 AM
shorter solution:

window.open(location, 'middle');



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum