469,288 Members | 2,353 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,288 developers. It's quick & easy.

how can i make a choice?

<SCRIPT TYPE="text/javascript">
if (screen.width==1024) {
distanza=100;
sinistra=100;
}
else {
distanza=10;
sinistra=10;
}
document.write(screen.width);
</script>

....

< href="noJS.html"

onclick="apri('frametotali.htm','finestra1','width =790,height=565,top=?,left
=?,toolbar=no,resizable=no');">
I wanna make a choice
if resolution is 1024x768 distanza and sinistra will get 100 as value
if resolution is 800x600 distanza and sinistra will get 10 as value
How can i apply those values to the top and left of the popup opened by the
onclick?

thank you
daniele
Jul 20 '05 #1
4 2450
"Daniele petracca" <pa****@panservice.it> writes:
<SCRIPT TYPE="text/javascript">
if (screen.width==1024) {
distanza=100;
sinistra=100;
}
else {
distanza=10;
sinistra=10;
}
document.write(screen.width);
</script>

...

< href="noJS.html"

onclick="apri('frametotali.htm','finestra1','width =790,height=565,top=?,left
=?,toolbar=no,resizable=no');">
I wanna make a choice
if resolution is 1024x768 distanza and sinistra will get 100 as value
if resolution is 800x600
.... or *any* other resolution, including 1600x1200 and up ...
distanza and sinistra will get 10 as value How can i apply those values to the top and left of the popup opened by the
onclick?


Easy. But before telling you how, I'll tell you why not :)

I use Opera in MDI mode. That means that all new page windows are
opened inside the Opera application window. That means that the screen
resolution has *no* impact on the browser window size, not even for
newly opened windows. I run my screen at 1600x1200, but my browser is
only about 800 pixels wide.

Your values (10 or 100) are not bad. If I keep my browser at 800 pixels
wide, I will be able to see the entire opened window (790px wide and
at 10px from the left). If you changed 1600x1200 to also set distanza
to 100, then I would miss 90 pixles of the window.

Generally, you should let the browser position new windows. It knows the
user's setup better than you ever will.

Anyway, if you insist:

onclick="apri('frametotali.htm','finestra1','width =790,height=565,'+
'top='+distanza+',left='+sinistra+',toolbar=no,res izable=yes');">

There is no good reason to not make the window resizable. Don't try to
control the user's machine. If he wants to resize, let him, or he will
just get irritated.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2

"Lasse Reichstein Nielsen" <lr*@hotpop.com> wrote in message
There is no good reason to not make the window resizable. Don't try to
control the user's machine. If he wants to resize, let him, or he will
just get irritated.


There is one context in which a non-resizeable window is appropriate.
That is with pages that function as custom alert windows. In other
words, basic or no graphics, little text, and size no more than about
300x200 or so.
--
--
Fabian
Visit my website often and for long periods!
http://www.lajzar.co.uk

Jul 20 '05 #3
"Fabian" <la****@hotmail.com> wrote in message
news:bm************@ID-174912.news.uni-berlin.de...
There is no good reason to not make the window resizable. Don't
try to control the user's machine. If he wants to resize, let
him, or he will just get irritated.


There is one context in which a non-resizeable window is
appropriate. That is with pages that function as custom alert
windows. In other words, basic or no graphics, little text,
and size no more than about 300x200 or so.


That pre-supposes that you have control over the font size. As most CSS
capable browsers allow the user the option of overriding details like
font size with user style sheets it cannot be valid to assume that
whatever (or however little) text you put into that window it will still
all always be visible at 300x200 (Assuming the user's screen will
accommodate that anyway).

I tend to think of it like this: If you get the window the right size
the user will not attempt to re-size it (because it is already the right
size), so they will never care (maybe not even notice) whether it is
resizable or not, if you get the size wrong the user will need to
re-size it and will be annoyed if they cannot. As the window re-sizing
controls have negligible impact on the appearance of windows I can see
no reason for not leaving them re-sizeable.

On the other hand, should a pop-up window be being used as a custom
alert? Given the ever growing unreliability of pop-up windows (and the
need to provide an alternative for browsers that have no window.open
function) I would have though that DHTML within the window was a
considerably more reliable approach for a custom alert.

Richard.
Jul 20 '05 #4
thank to everybody
i solved my great problem and made a step ahead in javascript

thanks
daniele
Jul 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

198 posts views Thread by Sridhar R | last post: by
4 posts views Thread by Dennis Vroegop | last post: by
1 post views Thread by Oleg Ogurok | last post: by
4 posts views Thread by Sergey Poberezovskiy | last post: by
2 posts views Thread by hooomee | last post: by
reply views Thread by Peter Larsen | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.