Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
How to go back to the parent window ?
Old 09-03-2006, 09:01 AM How to go back to the parent window ?
Average Talker

Posts: 20
Trades: 0
#1
09-01-2006, 09:57 PM
DaveinLondon vbmenu_register("postmenu_631799", true);
Registered User
Join Date: Jul 2004
Location: UK
Posts: 396


How do I get back to prevois window ?
Hi all.

My script launches a new window when the link is clicked.
here is the link:

<td class="ad_top_row"><a href='$Ad_detail' target='_blank' onclick=\"window.open (this.href, '$Ad_detail', 'height=800,width=960,scrollbars'); return false\" ><b>$event</b></a></td>

In the new window (the child window) is a form that then calls another script - called do_it when the form is submitted.

I want to run this script in the parent window.

Is that possible - How do I do it ?


This is my form ( in the child window):

PHP Code:
<form name="detail" action = "do_it.php" method = 'POST'> 
<td style="vertical-align:center; height:30px;"> 
<input type="hidden" name="ad_ref" value= "<?php echo "$ad_ref"?>" > 
<input type="hidden" name="section" value= "<?php echo "$section"?>" > 
<input type="hidden" name="x_detail" value= "<?php echo "$N_detail"?>" > 
<input type="hidden" name="x_yct" value= "<?php echo "$N_yct"?>" > 
<input type="hidden" name="x_yct_op" value= "<?php echo "$N_yct_op"?>" > 
<input type="TEXT" name="x_reason" value = "enter reason" 
size = '40' maxlength='200' /> 
</td> 
</tr> 
<tr> 
<td> 
<input type="submit" class="btn_wide1" value = "Delete Advert and send Email." 
onMouseover="this.style.backgroundColor='#66ccff'" 
onMouseout="this.style.backgroundColor='#ccffff'" > 
</td> 
</form>
Thanks very much for your help.

dave
__________________
Developers Choice Revealed:
Please login or register to view this content. Registration is FREE

Which host has won, and why ?
Jetti is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-03-2006, 01:18 PM Re: How to go back to the parent window ?
funkdaddu's Avatar
Web Design Snob

Posts: 635
Trades: 0
In the opening window set the name of the window in JS:
Code:
window.name = "oldwin";
in the opened form window, target the form to the name of the old window, and use an onsubmit handler to focus the old window:
Code:
<form id="FormName" action="do_it.php" method="get" name="FormName" target="oldwin" onsubmit="oldwin.focus();">
funkdaddu is offline
Reply With Quote
View Public Profile Visit funkdaddu's homepage!
 
Old 09-05-2006, 05:13 AM Re: How to go back to the parent window ?
Average Talker

Posts: 20
Trades: 0
Sorry to be a bit dumb ...
... but should the - window.name = "oldwin"

be in the HEAD of the document of tha parent window in this format ?


Code:
 
<script type="text/javascript">
<!--
window.name = "oldwin";
// -->
</script>
__________________
Developers Choice Revealed:
Please login or register to view this content. Registration is FREE

Which host has won, and why ?
Jetti is offline
Reply With Quote
View Public Profile
 
Old 09-05-2006, 06:26 AM Re: How to go back to the parent window ?
Average Talker

Posts: 20
Trades: 0
I am working on this - please help if you can.


I put this in the parent / opener window:

Code:
 
<head>
<script type="text/javascript">
<!--
window.name = "oldwin";
// -->
</script>
</head>
<body>
my form (in child window) now says this:

Code:
 
<div style='width:400px;position:absolute;left:600px; top:600px;' >
<form name="suspended" action ="a_run_top.php" method = 'POST' target="oldwin" onsubmit="this.close() window.oldwin.focus();">
<input type="hidden" name="del_ctl" value= "Y" >
<input type="hidden" name="section" value= "<?php echo "$section"; ?>" >
<input type="hidden" name="x_yct" value= "<?php echo "$N_yct"; ?>" >
<input type="hidden" name="x_yct_op" value= "<?php echo "$N_yct_op"; ?>" >
<input type="submit" class="btn2"  value = "Continue"
onMouseover="this.style.backgroundColor='green'" 
onMouseout="this.style.backgroundColor='#ccffff'" >
</form>
</div>
But the result is that the script runs in the child window.

I am trying to get the child window closed and the script to run in the parent / opener window.

Any more ideas / corrections ?

Thanks for help.

dave
__________________
Developers Choice Revealed:
Please login or register to view this content. Registration is FREE

Which host has won, and why ?
Jetti is offline
Reply With Quote
View Public Profile
 
Old 09-05-2006, 11:02 AM Re: How to go back to the parent window ?
funkdaddu's Avatar
Web Design Snob

Posts: 635
Trades: 0
1) "this" in your form onsubmit script is referring to the form, not the page so you need "window.close();"
2) you need a semicolon between your JS commands: window.close(); window.oldwin.focus();

Which browser are you using? This method works fine in FireFox...
funkdaddu is offline
Reply With Quote
View Public Profile Visit funkdaddu's homepage!
 
Old 09-06-2006, 03:45 AM Re: How to go back to the parent window ?
Average Talker

Posts: 20
Trades: 0
Thanks - I changed it and it works well in FF

Will I have probs in IE with this sort of thing?
__________________
Developers Choice Revealed:
Please login or register to view this content. Registration is FREE

Which host has won, and why ?
Jetti is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to How to go back to the parent window ?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.38382 seconds with 12 queries