Forum Moderators: open

Message Too Old, No Replies

keeping a popup window on top

keeping a popup window on top

         

rich413

9:32 pm on Aug 16, 2004 (gmt 0)

10+ Year Member



Help for a novice again please,

The below script was provided by Gul_Dukat earlier tonight and it worked like a dream... it carries data across from a html form into a popup window and then runs the data through a php script.

<script type="text/javascript" language="JavaScript"> <!-- function DoThis12() { var myW = window.open("","myW","height=400,width=500,scrollbars=yes,resizable=yes,statusbar=yes,menubar=yes,toolbar=yes,dependent=yes") } --> </script>
And in your form tag

<form method="POST" action="index_quote_result.php?<?php echo $post php?>&<?php echo $code php?>&<?php echo $unit_size php?>" onsubmit="DoThis12()" target="myW" >

however I have another problem. The popup window delivers a live quote based on the input in the html form. The websurfer can then change some dropdowns on the form and click for another quote. If they don't close the original popup window with the quote in it, the new quote arrives in the same popup window which is now hidden behind the main browser window. How can I either adapt the above script to keep the popup window 'on top' or have the original popup window close when a new quote is requested?

Thanks again.

Peb0

9:36 pm on Aug 16, 2004 (gmt 0)

10+ Year Member



Your quote pop-up window must have a name...

When your parent window submits information to the pop-up, just have a JS function set the focus on it.

Gul_Dukat

10:11 am on Aug 17, 2004 (gmt 0)

10+ Year Member



Hello again, rich413

As Peb0 says you can set on myW the focus when call

Try so


<script type="text/javascript" language="JavaScript"> <!--
function DoThis12() { var myW = window.open("","myW","height=400,width=500,scrollbars=yes,resizable=yes,statusbar=yes,menubar=yes,toolbar=yes,dependent=yes") }
myW.focus()
-->
</script>

:-)

Peb0

2:31 pm on Aug 17, 2004 (gmt 0)

10+ Year Member



Give a man a fish and he'll eat for a day.
Teach a man to fish and he'll eat for a lifetime.

Stop giving away the the whole fish! I showed him where they swim.

Gul_Dukat, it's nice you gave him the snippets but all he's learned is how to cut and paste...

Bernard Marx

3:06 pm on Aug 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Even then he may still go hungry:


function DoThis12() {
var myW = window.open(
"","myW","height=400,width=500,scrollbars=yes,resizable=yes,statusbar=yes,menubar=yes,toolbar=yes,dependent=yes"
)
}
myW.focus()

The var keyword needs to be removed.
If not, then

myW
becomes a local variable, and will be inaccessible outside the function. The last line will then produce an error.
..or perhaps the last line is meant to be inside the function.

rich413

3:22 pm on Aug 17, 2004 (gmt 0)

10+ Year Member



The finished and working script. I would like to thank Gul_Dukat for all her help. I've never programmed before except for a little php at Christmas. Thanks to all of you for having the time to help out novices like me. Keep up the good work. rich.

<script type="text/javascript" language="JavaScript">
<!--
function DoThis12() {
var myW = window.open("","myW","height=400,width=500,scrollbars=yes,resizable=yes,statusbar=yes,menubar=yes,toolbar=yes,dependent=yes")
myW.focus()
}
-->
</script>

Gul_Dukat

3:37 pm on Aug 17, 2004 (gmt 0)

10+ Year Member




..or perhaps the last line is meant to be inside the function.

Yesss, you're right, the line must be inside the function ... just a lapsus, sorry :(


function DoThis12() {
var myW = window.open(
"","myW","height=400,width=500,scrollbars=yes,resizable=yes,statusbar=yes,menubar=yes,toolbar=yes,dependent=yes"
)

myW.focus()
}

greetings

Peb0

5:56 pm on Aug 17, 2004 (gmt 0)

10+ Year Member



No offense intended Rich413, it's more a reflection of my own learning habits.

If I'm given code on a platter, I can rarely remember quite how it worked. If I have to hunt and fiddle and sweat and swear, it usually sticks a lot better.

Good luck with your site :)