Page 1 of 1

Popupwindow focus problem

Posted: Thu Oct 14, 2004 10:54 am
by Shendemiar
I'm having some additional data in popupwindow. Opening goes ok, if i close it it remembers it's location etc. But i cant make it become in front. It opens in front, but after that it stays behind. Any links opening there opens fine, but it doesnt come in front.

Included in HEAD, sripts part:

Code: Select all

<?php
echo "var newWindow = null;";     
?>
Script:

Code: Select all

function makeNewWindow(url, name, features)
&#123;
newWindow = open(url, name, features);
if (newWindow &amp;&amp; !newWindow.closed)
newWindow.focus();
return false;
&#125;
Call:

Code: Select all

<?php
echo "<a href="index.php?MM=kysymykset&UKK_Vastaus=$UKK_V_ID" target="UKK" 
onclick="return makeNewWindow(this.href,this.target,'width=900,height=600,left=50,location,scrollbars')">Something</a>";
?>

Posted: Thu Oct 14, 2004 11:54 am
by Shendemiar
I added the $Pop_UP to the page body tag:

if ($_GET['MM']=="kysymykset")
$Pop_Up="onLoad=\"window.focus()\" ";
}

<body $Pop_Up>

and now it comes forward if i reload something into it

Posted: Thu Oct 14, 2004 12:06 pm
by Joe
When you say 'front' are you reffering to modal?.

Posted: Thu Oct 14, 2004 12:18 pm
by Shendemiar
Joe wrote:When you say 'front' are you reffering to modal?.
Mmm.. sorry, i don't understand :o

Front for me here = window shows in front of all other windows

Posted: Thu Oct 14, 2004 12:28 pm
by Joe
Yes modal is when the window is in front of all other windows. My suggestion is to use vbscript instead of javascript for this task. Something like:

Code: Select all

<script language="vbscript">
msgbox ("Hello"), vbmodal
</script>
Notice I made the popupbox modal?.

Posted: Thu Oct 14, 2004 12:33 pm
by Joe
I forgot to mention. A javascript alternative would be, showModalDialog()

Posted: Thu Oct 14, 2004 1:04 pm
by Shendemiar
Would be fine for alerts and simple data, but i need to run php and show complex html.

Anyway, i got my problem solved, well not exactly, but worked around at least ;)

Posted: Thu Oct 14, 2004 1:43 pm
by Joe
If you were looking for html to be shown then try showModalDialog() in javascript. It works perfect.