how can i make a choice?

D

Daniele petracca

<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
 
L

Lasse Reichstein Nielsen

Daniele petracca said:
<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,resizable=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
 
F

Fabian

Lasse Reichstein Nielsen said:
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.
 
R

Richard Cornford

Fabian said:
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.
 
D

Daniele petracca

thank to everybody
i solved my great problem and made a step ahead in javascript

thanks
daniele
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top