473,396 Members | 2,092 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

better screen.width or screen.availWidth

den
same thing for the height parameter;
for to set in the centre some popup with images what is better?
what are the difference?
Mar 5 '07 #1
6 7582
On Mar 5, 12:42 pm, den <spam...@not.notwrote:
same thing for the height parameter;
for to set in the centre some popup with images what is better?
what are the difference?

```````-Example-````````
<html>
<head>
<script type="text/javascript">
function openPP(a1){
wWidth=500;wHeight=30;
relWid=(a1?screen.width:window.innerWidth)/2; relHgh=(a1?
screen.height:window.innerHeight)/2
wLeft=(relWid>wWidth/2)?relWid-wWidth/2:screenX
wTop=(relHgh>wHeight/2)?relHgh-wHeight/2:screenY+10
window.open("about:blank","newP","left="+wLeft+",t op="+wTop
+",width="+wWidth+",height="+wHeight)
}
</script>
</head>
<body style="text-align:center">
<button onclick="openPP(0)">Open a window in center of browser</
button>
<button onclick="openPP(1)">Open a window in center of screen</button>
</body>
</html>

Mar 5 '07 #2
On Mar 5, 12:42 pm, den <spam...@not.notwrote:
same thing for the height parameter;
for to set in the centre some popup with images what is better?
what are the difference?
Reposting the example because of text-wrap in last post :

-<html>
-<head>
-<script type="text/javascript">
-function openPP(a1){
-wWidth=500;wHeight=30;
-relWid=(a1?screen.width:window.innerWidth)/2;
-relHgh=(a1?screen.height:window.innerHeight)/2
-wLeft=(relWid>wWidth/2)?relWid-wWidth/2:screenX
-wTop=(relHgh>wHeight/2)?relHgh-wHeight/2:screenY+10
-window.open("about:blank",
"newP","left="+wLeft+",top="+wTop+",width="+wW idth
+",height="+wHeight)
-}
-</script>
-</head>
-<body style="text-align:center">
-<button onclick="openPP(0)">Open a window in center of browser</
button>
-<button onclick="openPP(1)">Open a window in center of screen</
button>
-</body>
-</html>

Mar 5 '07 #3
On Mar 5, 2:02 pm, scripts.cont...@gmail.com wrote:
On Mar 5, 12:42 pm, den <spam...@not.notwrote:
same thing for the height parameter;
for to set in the centre some popup with images what is better?
what are the difference?

Reposting the example because of text-wrap in last post :

-wLeft=(relWid>wWidth/2)?relWid-wWidth/2:screenX
-wTop=(relHgh>wHeight/2)?relHgh-wHeight/2:screenY+10
screenX/screenY works in mozilla only. In opera and IE, it doesn't
work. So check the browser and for other browsers, use screenLeft/
screenTop.
Mar 5 '07 #4
sc*************@gmail.com said the following on 3/5/2007 5:24 PM:
On Mar 5, 2:02 pm, scripts.cont...@gmail.com wrote:
>On Mar 5, 12:42 pm, den <spam...@not.notwrote:
>>same thing for the height parameter;
for to set in the centre some popup with images what is better?
what are the difference?
Reposting the example because of text-wrap in last post :

-wLeft=(relWid>wWidth/2)?relWid-wWidth/2:screenX
-wTop=(relHgh>wHeight/2)?relHgh-wHeight/2:screenY+10

screenX/screenY works in mozilla only. In opera and IE, it doesn't
work. So check the browser and for other browsers, use screenLeft/
screenTop.
I hope you meant "check the feature" when you said "check the browser".

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Mar 5 '07 #5
On Mar 5, 5:02 pm, Randy Webb <HikksNotAtH...@aol.comwrote:
screenX/screenY works in mozilla only. In opera and IE, it doesn't
work. So check the browser and for other browsers, use screenLeft/
screenTop.

I hope you meant "check the feature" when you said "check the browser".

I was going to say that but then i was not sure about which feature
will be available in Mozilla but not in Opera, IE and maybe other
browsers.

Mar 5 '07 #6
sc*************@gmail.com said the following on 3/5/2007 6:34 PM:
On Mar 5, 5:02 pm, Randy Webb <HikksNotAtH...@aol.comwrote:
>>screenX/screenY works in mozilla only. In opera and IE, it doesn't
work. So check the browser and for other browsers, use screenLeft/
screenTop.
I hope you meant "check the feature" when you said "check the browser".


I was going to say that but then i was not sure about which feature
will be available in Mozilla but not in Opera, IE and maybe other
browsers.
That is why you feature detect for screenX or whatever it is that might
work. If the browser supports it, then you use it. If it doesn't, then
you don't worry about it.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Mar 6 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Clare Hsiao | last post by:
Hi,everybody: How can I use window.open to Open a page in the center of screen? I know showModalDialog() can,but I have to run both in IE and NN, so I have to use window.open to open a new...
2
by: Larry R Harrison Jr | last post by:
I have pull-down menus in javascript and I have the code for opening a link in a new window. But I want it to open a full-sized window. I can't figure out the syntax. What I have so far: ...
9
by: pow67 | last post by:
Is there a javascript statement which can be incorporated in a hyperlink which will open a new page that fills the screen while leaving the page with the link open? Thanks in advance. CW
9
by: Jensen bredal | last post by:
Is there any way i can view my web page in full screen mode? F11 still hhas the internet explorer tool bar. Many thanks in advance JB
7
by: tim | last post by:
can someone tell me which function returns the screen resolution in java script?
9
by: Steve Wright | last post by:
Hi I'm developing a webpage that needs to include a different stylesheet depending on the screen resolution. I know that I could read the resolution in javascript and then do some sort of...
24
by: dE|_ | last post by:
I have started looking into scripts for screen size detect with the intention of using them to pick from a number of CSS style sheets tailored to the size. Is there a good reason why this is not...
1
by: cook | last post by:
Hi at all INTO the css file Can I use the expression: img {width:screen.availWidth} Work it crossbrowser? How?
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.