Ask a Question related to Macromedia Dynamic HTML, Design and Development.
-
karlogaga #1
center window
Hi,
can someone tell me why this doesnt work or how to rewrite it?
<HEAD>
<script language="JavaScript">
self.moveTo(screen.availWidth * -(x - 50) / 100, screen.availHeight *
-(x - 50) / 100);
</script>
</HEAD>
The goal is that the window moves itself to the center of the screen onload.
Greetings Karlo
karlogaga Guest
-
Get center of users window
Hi I have the following problem. I have a Flex application that has modal pop up windows. The Flex app has a large hight, so I can't be sure the... -
Child window property window.opener null after postback
I have an webform from which I open a child window to display a calendar. When a date is selected in the calendar window it attempts to set the... -
How does one center a pop-up window using actionScript?
I repeat: How does one center a pop-up window using actionScript? -
dlopen is failing on Window XP works great on Window 2000
Michael Davis <mdavis@sevasoftware.com> writes: Check the permission of the so file: $ ls -l... -
Center in Window
My site is fullarmorgroup.com. Obviously, my first go at it. I am changing the background to black and want it to automatically center in any browser... -
The ScareCrow #2
Re: center window
What is "x", where is it's value set ?
But instead of opening the window and then moving it, why not just open it in
the middle to start with ?
See attached
Ken
function openWindow(){
var fileName, windowName, theHeight, theWidth, topPos, leftPos;
windowName = "WinName";
fileName = "FileName.cfm";
theHeight = 300;
theWidth = 300;
topPos = (screen.height/2) - (theHeight/2);
leftPos = (screen.width/2) - (theWidth/2);
window.open(fileName,windowName,"left="+leftPos+", top="+topPos+",toolbar=0,loca
tion=0,directories=0,status=0,menubar=0,scrollbars =1,resizable=1,width="+theWidt
h+",height="+theHeight);
}
The ScareCrow Guest
-
wetcell #3
Re: center window
Ken, being the novice I am I've obviously set this up incorrect, as no window
is appearing.
Any suggestions would be greatly appreciated. This is what I currently have:
<script language="Javascript">
<!--
function?openWindow()
{
?????var?fileName,?windowName,?theHeight,?theWidth ,?topPos,?leftPos;
?????windowName?=?"splash";
?????fileName?=?"splash2.html";
?????theHeight?=?342;
?????theWidth?=?680;
?????topPos?=?(screen.height/2)?-?(theHeight/2);
?????leftPos?=?(screen.width/2)?-?(theWidth/2);
?????window.open(fileName,windowName,"left="+leftP os+",top="+topPos+",toolbar=0,
location=0,directories=0,status=0,menubar=0,scroll bars=1,resizable=1,width="+the
Width+",height="+theHeight);
}
//-->
</script>
wetcell Guest
-
The ScareCrow #4
Re: center window
There is nothing wrong with this javascript.
You need to have a link to click on to activate the function
<a href="javascript:openWindow();">Open Window</a>
Put this link in the page where you want the popup to open from
Ken
The ScareCrow Guest
-
wetcell #5
Re: center window
Thanks Ken. Will this work with something like this?
<body onload="javascript:openWindow();">
I'd like the window open automatically when the page is entered.
Thanks for your help : )
wetcell Guest
-
The ScareCrow #6
Re: center window
Yes, that will onpen the window after the initial page has loaded. Just note that the window opened through this javascript will be on top of the other page and have the focus
Ken
The ScareCrow Guest
-
wetcell #7
Re: center window
I'm not having any joy here. Sorry to be a pain. Here is the test page:
[url]http://www.jlbgroup.com.au/index2.asp[/url]
I've tried both onload and also a link (it's in the left column)
Any ideas?
wetcell Guest
-
The ScareCrow #8
Re: center window
When I went to that page.
The window open automatically, the page went from white to blue to purple to
green then to white and then closed.
When I click on the link the same thing happens.
Do you have javascript enabled in your browser ?
Ken
The ScareCrow Guest
-
wetcell #9
Re: center window
Oh. I'm thinking it's because I'm using an Apple. Checking this on my PC now.
Thanks very much.
wetcell Guest
-
wetcell #10
Re: center window
Yes it works on my windows machine!
Incase your intersted; it didn't work in IE 5.2 or Safari under OS X.
wetcell Guest
-
Murray *TMM* #11
Re: center window
Change it to -
<body onload="openWindow();">
You don't need the javascript: there....
--
Murray --- ICQ 71997575
Team Macromedia Volunteer for Dreamweaver MX
(If you *MUST* email me, don't LAUGH when you do so!)
==================
[url]news://forums.macromedia.com/macromedia.dreamweaver[/url] - THE BEST WAY TO GET
ANSWERS
==================
[url]http://www.dreamweavermx-templates.com[/url] - Template Triage!
[url]http://www.projectseven.com/go[/url] - DW FAQs, Tutorials & Resources
[url]http://www.dwfaq.com[/url] - DW FAQs, Tutorials & Resources
[url]http://www.macromedia.com/support/search/[/url] - Macromedia (MM) Technotes
==================
"wetcell" <webforumsuser@macromedia.com> wrote in message
news:c93q3t$kh$1@forums.macromedia.com...> Thanks Ken. Will this work with something like this?
>
> <body onload="javascript:openWindow();">
>
> I'd like the window open automatically when the page is entered.
>
> Thanks for your help : )
Murray *TMM* Guest
-
karlogaga #12
Re: center window
Hi Ken,
thank you very much for answering, i had given up on getting an answer
already...
To your first question, i dont know what the "x" is, i just copied the
script out of a function.
Its that i want the window to move to the center when someone types in
the Url in a browser, not from a link.
Since it is possible to move the window to the center, i wonder if you
could also define something different than the center, something like
having the left corner of the new window opening 200 pixels left from
the center and 200 pixels higher than the center?
Thanx and greetings Karlo
The ScareCrow wrote:> What is "x", where is it's value set ?
>
> But instead of opening the window and then moving it, why not just open it in
> the middle to start with ?
>
> See attached
>
> Ken
>
>
>
> function openWindow(){
> var fileName, windowName, theHeight, theWidth, topPos, leftPos;
> windowName = "WinName";
> fileName = "FileName.cfm";
> theHeight = 300;
> theWidth = 300;
> topPos = (screen.height/2) - (theHeight/2);
> leftPos = (screen.width/2) - (theWidth/2);
>
> window.open(fileName,windowName,"left="+leftPos+", top="+topPos+",toolbar=0,loca
> tion=0,directories=0,status=0,menubar=0,scrollbars =1,resizable=1,width="+theWidt
> h+",height="+theHeight);
> }
>karlogaga Guest
-
The ScareCrow #13
Re: center window
Put the attached code in the page that is to be opened in the popup window.
Just change the values for the width and height to what ever you need.
Ken
<script language="JavaScript">
<!--
// bWidth is the width of the window
// bHeight is the height of the widow
var bWidth = 300;
var bHeight = 300;
self.moveTo((screen.width/2) - (bWidth/2), (screen.height/2) - (bHeight/2));
//-->
</script>
The ScareCrow Guest
-
karlogaga #14
Re: center window
Hi Ken, this rocks, thank you very much!
Karlo
The ScareCrow wrote:> Put the attached code in the page that is to be opened in the popup window.
> Just change the values for the width and height to what ever you need.
>
>
> Ken
>
> <script language="JavaScript">
> <!--
> // bWidth is the width of the window
> // bHeight is the height of the widow
> var bWidth = 300;
> var bHeight = 300;
> self.moveTo((screen.width/2) - (bWidth/2), (screen.height/2) - (bHeight/2));
> //-->
> </script>
>karlogaga Guest
-
simsghost aka TSGN.net #15
Re: center window
looks good... worked for me
--
---
Best Regards,
Jeremy Cowan
edmforsale At tsgn dot net
"karlogaga" <karlogaga@yahoo.com> wrote in message
news:c96rbc$o5m$05$1@news.t-online.com...window.> Hi Ken, this rocks, thank you very much!
>
> Karlo
>
>
>
>
> The ScareCrow wrote:> > Put the attached code in the page that is to be opened in the popup(bHeight/2));> > Just change the values for the width and height to what ever you need.
> >
> >
> > Ken
> >
> > <script language="JavaScript">
> > <!--
> > // bWidth is the width of the window
> > // bHeight is the height of the widow
> > var bWidth = 300;
> > var bHeight = 300;
> > self.moveTo((screen.width/2) - (bWidth/2), (screen.height/2) -> > //-->
> > </script>
> >
simsghost aka TSGN.net Guest



Reply With Quote

