Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > JavaScript and window appearance

JavaScript and window appearance
Thread Tools
Fresh-Faced Recruit
Join Date: Jan 2001
Location: England
Status: Offline
Reply With Quote
Nov 20, 2002, 11:58 AM
 
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
Reply With Quote
Nov 20, 2002, 01:10 PM
 
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
Reply With Quote
Nov 20, 2002, 02:41 PM
 
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
Reply With Quote
Nov 25, 2002, 07:10 AM
 
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
Reply With Quote
Nov 25, 2002, 08:30 AM
 
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
Reply With Quote
Nov 25, 2002, 08:41 AM
 
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
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 06:22 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2