473,569 Members | 2,813 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

better screen.width or screen.availWid th

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 7591
On Mar 5, 12:42 pm, den <spam...@not.no twrote:
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;wHei ght=30;
relWid=(a1?scre en.width:window .innerWidth)/2; relHgh=(a1?
screen.height:w indow.innerHeig ht)/2
wLeft=(relWid>w Width/2)?relWid-wWidth/2:screenX
wTop=(relHgh>wH eight/2)?relHgh-wHeight/2:screenY+10
window.open("ab out:blank","new P","left="+wLef t+",top="+wTo p
+",width="+wWid th+",height="+w Height)
}
</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.no twrote:
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;wHei ght=30;
-relWid=(a1?scre en.width:window .innerWidth)/2;
-relHgh=(a1?scre en.height:windo w.innerHeight)/2
-wLeft=(relWid>w Width/2)?relWid-wWidth/2:screenX
-wTop=(relHgh>wH eight/2)?relHgh-wHeight/2:screenY+10
-window.open("ab out:blank",
"newP","left="+ wLeft+",top="+w Top+",width="+w Width
+",height="+wHe ight)
-}
-</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.no twrote:
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>w Width/2)?relWid-wWidth/2:screenX
-wTop=(relHgh>wH eight/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.no twrote:
>>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>w Width/2)?relWid-wWidth/2:screenX
-wTop=(relHgh>wH eight/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.javas cript 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.javas cript 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
2133
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 page. Is ther any help? Thanks a lot.
2
4380
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: Menu5_5_1=new Array("'Lonely Church","javascript:window.open ('http://www.photo.net/photodb/photo?photo_id=2640310')","",0,20,300); That works fine,...
9
12289
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
3097
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
8087
by: tim | last post by:
can someone tell me which function returns the screen resolution in java script?
9
3892
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 stylesheet switcher as part of the onload event but I would rather link in the correct stylesheet for the resolution in the first place.
24
2987
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 so commonly done? IE am I wasting my time? ---dE|_---
1
3276
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
7703
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7926
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8138
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7983
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5223
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3657
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1228
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
946
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.