|
-
Nov 27th, 2001, 05:45 AM
#1
Thread Starter
Hyperactive Member
(RESOLVED) Screen size and center
Using Javascript I want to be able to open my default home page with the browser screen set to a certain height, width and centered on the screen. Can this be done?
I can open a new window and do this, but thats not what I'm after.
Last edited by parkes; Nov 27th, 2001 at 06:50 AM.
Thanks in advance for any help provided.
VB 6 Enterprise Edition SP4
ADO, SQL 7/2000, ASP and some JavaScript

>> Life goes on, but for how long? <<
If you can smile when things go wrong, you have someone in mind to blame
-
Nov 27th, 2001, 05:57 AM
#2
Hyperactive Member
-
Nov 27th, 2001, 06:03 AM
#3
Thread Starter
Hyperactive Member
'fraid not' does this mean it cannot be done at all?
Thanks in advance for any help provided.
VB 6 Enterprise Edition SP4
ADO, SQL 7/2000, ASP and some JavaScript

>> Life goes on, but for how long? <<
If you can smile when things go wrong, you have someone in mind to blame
-
Nov 27th, 2001, 06:09 AM
#4
Hyperactive Member
It can't be done clientside, you might have a chance with a server side laguage, but i doubt it!
Tyr the ASP forum it is probbaly your best bet ......
-
Nov 27th, 2001, 06:15 AM
#5
Thread Starter
Hyperactive Member
Well as we speak I tried this bit of code I wrote and it seem to do what I want, even when I just refresh or open my default page. It seems okay in IE, haven't tried it in NS or any others, but it seem to work.
function setBrowser()
{
tmpWin=window.self;
x=(795);
y=(590);
var t = (screen.width) ? (screen.width-x)/2 : 0;
var l = (screen.height) ? (screen.height-y)/2 : 0;
tmpWin.resizeTo(x,y);
tmpWin.moveTo(t,l);
}
<body onLoad="setBrowser();">
Give it a shot and let me know what you think or if it works at all for you.
Thanks in advance for any help provided.
VB 6 Enterprise Edition SP4
ADO, SQL 7/2000, ASP and some JavaScript

>> Life goes on, but for how long? <<
If you can smile when things go wrong, you have someone in mind to blame
-
Nov 27th, 2001, 06:29 AM
#6
PowerPoster
hi
If the thread starter himself asnwers the question then I get .
Please someone explain this to ME.
-
Nov 27th, 2001, 06:32 AM
#7
Thread Starter
Hyperactive Member
Sorry about that, I had been trying for days to get this thing to work so I posted the question, but kept trying and I was surprised to say the least that it seem to work, I've just asked anyone who reads this to see it it works okay for them
Hope this explains my reason for the posting.
Thanks in advance for any help provided.
VB 6 Enterprise Edition SP4
ADO, SQL 7/2000, ASP and some JavaScript

>> Life goes on, but for how long? <<
If you can smile when things go wrong, you have someone in mind to blame
-
Nov 27th, 2001, 06:33 AM
#8
Hyperactive Member
I stand corrected, it works for me.
works to a degree in nutscrape!
I would however like to point out that if a site did that to my browser i'd be reaching for the cross in the corner of my browser and clicking it!
-
Nov 27th, 2001, 06:35 AM
#9
Thread Starter
Hyperactive Member
To progressive: Any reason why you would close the screen if it did that to you?
Just wondering
Thanks in advance for any help provided.
VB 6 Enterprise Edition SP4
ADO, SQL 7/2000, ASP and some JavaScript

>> Life goes on, but for how long? <<
If you can smile when things go wrong, you have someone in mind to blame
-
Nov 27th, 2001, 06:39 AM
#10
Hyperactive Member
Because It's intruding on my browser, you didn't open it I did.
I opened it and had it all nice and set out the way i like it then you come along and mess with it.
It's my window so leave it alone!
...no offence but this is the view of most users so try to avoid it if possible.
heres how you get it to work in netscape 4!
Code:
<script>
function setBrowser()
{
tmpWin=window.self;
x=(795);
y=(590);
var t = (screen.width) ? (screen.availWidth-x)/2 : 0;
var l = (screen.height) ? (screen.availHeight-y)/2 : 0;
if (document.all){
tmpWin.resizeTo(x,y);
}else{
tmpWin.outerHeight = y;
tmpWin.outerWidth = x;
}
tmpWin.moveTo(t,l);
}
</script>
<body onLoad="setBrowser();">
-
Nov 27th, 2001, 06:42 AM
#11
Thread Starter
Hyperactive Member
Cheers for that.
..No offence taken, always open to suggestions. It only going to be used to internal use anyway. Though others may like to use the code.
Is there a way on this site to submit code like this for people to use.
Thanks in advance for any help provided.
VB 6 Enterprise Edition SP4
ADO, SQL 7/2000, ASP and some JavaScript

>> Life goes on, but for how long? <<
If you can smile when things go wrong, you have someone in mind to blame
-
Nov 27th, 2001, 06:43 AM
#12
PowerPoster
hi
It works in IE havent tested it in Netscape.
But I wonder why would you want to do it in the first place.
secondly, I agree with progressive. that the main window should not be touched.
-
Nov 27th, 2001, 06:47 AM
#13
Hyperactive Member
It'll be alright here people will find it by doing a search!
Seeing as it's for internal use it'll be fine, but If you ever use on a corporate site then you better make sure your content grabs me by the eye balls and makes me go "whooaaa would you look at that" or i'll close it!
-
Nov 27th, 2001, 06:49 AM
#14
Hyperactive Member
oh yeah edit your first post and put resolved in the subject so people know the problem has been solved!!
-
Nov 27th, 2001, 06:49 AM
#15
Thread Starter
Hyperactive Member
No worries thanks and take care.
Thanks in advance for any help provided.
VB 6 Enterprise Edition SP4
ADO, SQL 7/2000, ASP and some JavaScript

>> Life goes on, but for how long? <<
If you can smile when things go wrong, you have someone in mind to blame
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|