Click to See Complete Forum and Search --> : Naming a popup window from WinOpen?


Namuna
08-21-2003, 05:58 PM
This is my current code:

<script language="JavaScript">
function WinOpen(url,x,y) {
var options = "toolbar=no,scrollbars=yes,resizable=yes,width=" + x + ",height=" + y;
msgWindow=window.open(url,"WinOpen",options);
}
</script>

I'm happy with the script as far as giving me the flexibility to size windows accordingly with image sizes...But what's missing is the option of a title for popup window.

How do I add that component in?

Thanks.

Khalid Ali
08-21-2003, 07:54 PM
this is how
msgWindow.document.title="new title"

Namuna
08-22-2003, 11:57 AM
Thanks for the reply Khalid.

I'm doing something wrong with the code though...I've added the extra line as you said, like this:

<script language="JavaScript">
function WinOpen(url,x,y) {
var options = "toolbar=no,scrollbars=yes,resizable=yes,width=" + x + ",height=" + y;
msgWindow=window.open(url,"WinOpen",options);
msgWindow.document.title="My Page";
}
</script>

But I'm getting error on page.

pyro
08-22-2003, 12:03 PM
What error message?

Namuna
08-23-2003, 12:21 PM
Thanks for the help, I was actually able to find an even better script and does a great job for me (auto window size to image, with popup window title)