 |
 |
JavaScript and window appearance
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Jan 2001
Location: England
Status:
Offline
|
|
Hello
Do you know of a good explanation / tutorial for controlling window appearance in JavaScript (on the web)?
I'd like my pop up window to be 90% of users screen size.
The code I use at the moment isn't too reliable, so wonder if there are any links to good ones I might glean / view source and learn from.
TIA
|
|
|
| |
|
|
|
 |
|
 |
|
Occasionally Useful
Join Date: Jun 2001
Location: Liverpool, UK
Status:
Offline
|
|
hey there, english person
have you trawled through http://javascript.internet.com and all those kinda sites? maybe simon mundy can help you? he seems like a jolly nice chap, so i'm sure he will
i'm curious about this, though: why 90%?
|
|
"Have sharp knives. Be creative. Cook to music" ~ maxelson
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Jun 2001
Location: Melbourne, Australia
Status:
Offline
|
|
Originally posted by philzilla:
maybe simon mundy can help you? he seems like a jolly nice chap, so i'm sure he will
If I'd have slept more, maybe. Curse these November deadlines...
Here's what I'd suggest: (Feel free to suggest improvements if you like):
function popUpWin(loc) {
width=parseInt(screen.width * 0.90);
height=parseInt(screen.height * 0.90);
win = open('','glossary','alwaysRaised=yes,directories=n o,location=no,menubar=no,status=no,titlebar=no,too lbar=no,scrollbars=no,width='+width+',height='+hei ght+',resizeable=no');
win.href = loc;
scrx = screen.width;
scry = screen.height;
win.moveTo((scrx/2)-(width/2),(scry/2)-(height/2));
}
|
|
Computer thez nohhh...
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Jan 2001
Location: England
Status:
Offline
|
|
Thanks both for suggestion....
Simon, regretfully my JavaScript know how isn't that hot, so I will have to go and figure where and how to use that code.
I tried pasting it into a page, but it didn't work . I will have to read up a bit more before I can view a result to comment on, but thanks all the same.
Philzilla - I guess 90% screen size, as I think a user might get freaked if I take up whole 100%, especially as I dont want scroll bars or menubar. Also haven't had time to study your link, but will do soon...
Best 
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: May 2001
Location: Nottingham, UK
Status:
Offline
|
|
Hi Daisy
to use that code you need a special sort of link.
Firstly, copy Simon's code, and put anywhere in the HEAD tag:
(btw you will have to replace the [ and ] with proper greater than/less than tags. The forum won't let me do those)
eg
[html]
[head]
[script language="JavaScript" type="text/javascript"]
[!--
function popUpWin(loc) {
width=parseInt(screen.width * 0.90);
height=parseInt(screen.height * 0.90);
win = open('','glossary','alwaysRaised=yes,directories=n o,
location=no,menubar=no,status=no,titlebar=no,toolb ar=no,
scrollbars=no,width='+width+',height='+height+',re sizeable=no');
win.href = loc;
scrx = screen.width;
scry = screen.height;
win.moveTo((scrx/2)-(width/2),(scry/2)-(height/2));
}
--]
[/script]
[/head]
now when you want a popup, put this code in the link tag
eg
[a href="#" onClick="popUpWin(whatever.htm);"]Link text here[/a]
change whatever.htm to the name of your page, and that should work. Try it and let us know. 
(Last edited by derbs; Nov 25, 2002 at 08:38 AM.
)
|
|
|
| |
|
|
|
 |
|
 |
|
Occasionally Useful
Join Date: Jun 2001
Location: Liverpool, UK
Status:
Offline
|
|
heh, i was just about to type all that out. quick draw derbs beat me to it 
|
|
"Have sharp knives. Be creative. Cook to music" ~ maxelson
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|