Flasher Archive
[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]
Subject: | Re: FLASH: Javascript and absolute positioning |
From: | Cheri Harder |
Date: | Fri, 23 Jun 2000 22:14:39 +0100 |
Funny you should ask. Only yesterday, I put three scripts together to do
something very similar. I am forcing the window to be the size of the
content, and centering it. I started with I think it is Branden's relative
window opener, added it to something I found that centered it (maybe was the
same script) and added the resolution detection that Barranger wrote for the
Flashability.org group. You simply have to feed it the width of your page
in the onClick call to the function....(these were fixed-width
table/form/pages I was using...and I'm also sending it a long query-string
in the <%= variable %> that you won't need)
The script:
<script language="JavaScript"><!--
function openRelativeWindow(theURL, theName, baseWidth, baseHeight){
browser = navigator.appName;
comment: Get the full screen size
fullWidth = screen.width;
fullHeight = screen.height;
comment: Get the available screen Size
if (browser.indexOf("WebTV") >= 0)
{
width = window.innerWidth-16;
height = window.innerHeight;
fullHeight = window.outerHeight;
fullWidth = window.outerWidth;
}
else if (browser.indexOf("Microsoft") >= 0)
{
width = document.body.offsetWidth - 20;
height = document.body.offsetHeight;
colorDepth = window.screen.colorDepth;
}
else if (browser.indexOf("Netscape") >= 0)
{
width = window.innerWidth-16;
height = window.innerHeight;
colorDepth = window.screen.pixelDepth
}
var X = 0;
var Y = 0;
aspectRatio = (baseWidth/baseHeight);
calcWidth = (screen.width/fullWidth)*baseWidth;
calcHeight = calcWidth / aspectRatio;
if (screen.availWidth) {
X = (screen.availWidth / 2) - (calcWidth /2);
Y = (screen.availHeight / 2) - (calcHeight / 2);
}
var MyRemote=window.open(theURL,theName,"left=" + X + "screenX=" + X +
"screenY=" + Y + ",top=" + Y + ",width=" + calcWidth + ",height=" +
calcHeight +",scrollbars=1,menubar=1,resizable=1");
MyRemote.focus();
}
// -->
</script>
And in the body:
<a href="reserve.asp" onClick="openRelativeWindow('reserve.asp?<%= ItemID1
%>','NewWindow',360,560); return false;" ><img src="promos/reserve.gif"
height="10" name="reserve" border="0" width="270"></a>
Oh, and as an added bonus, this one will re-gain focus if the same window is
called again while it is still open.
HTH!
~~~~Cheri Harder~~~~~
charderawsolution [dot] com
Advantage Web Solution
www.awsolution.com
----- Original Message -----
From: "Mick Southerland" <mick_southerlandhotmail [dot] com>
> I need to set a variable absolute position of an image (wish I could use
> flash) based on the screen resolution of the users monitor.
>
> Example if the user is @ 800 then the image would be L=100px T=100px and
if
> the user is at 1024 the image would be at L=250px T=250px
>
> something like that. I can't seem to find any examples. If anyone has a
site
> where they used something like this or knows where I can find sample code,
> I'd be very grateful
flasher is generously supported by...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
flashforward2000 and the Flash(tm) Film Festival
July 24-26, 2000, NEW YORK CITY, Hammerstein Ballroom
www.flashforward2000.com
Produced by United Digital Artists and lynda.com
Sponsored by Macromedia, Adobe Systems, Fusion, Inc, AtomFilms,
shockwave.com and Electric Rain.
1.877.4.FLASH.4 or (1.805.640.6679 outside the US and Canada)
Register before June 30 and save $200!!-- www.flashforward2000.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe or change your list settings go to
http://www.chinwag.com/flasher or email helpchinwag [dot] com
Replies
FLASH: Javascript and absolute positioni, Mick Southerland
[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]