View Full Version : is there a way that these to codes can be combined?
me-so-sleepy
12-14-2002, 10:28 PM
this one..
<A HREF="main.htm" TARGET="popup" ONCLICK="window.open('main.htm', 'popup', 'width=680,height=475')"><img src="intro.jpg" border="0"></a>
and this one..
<script>
window.onload=doit
function doit(){
window.resizeTo(500,500);/* the first number is for width, the second height*/
window.focus(); //brings window to front
}
</script>
because i want the window to load at a custom size.. but i dont want the control bars or scroll bar or status bar i only want the blue bar at the top with the 'close' 'minimize' and 'restore' buttons on it.. this is what the first code makes the window look like when the link is clicked on an the window pops up.
so yea is there a way? if so whats the code :D
thnx
Matt
Dalsor
12-15-2002, 12:13 AM
Found this one a google search...
<BODY onLoad="configure()" onResize="changeback()">
</BODY>
<SCRIPT>
function configure(){
window.resizeTo(300,300)
window.moveTo(300,300)
}
function changeback(){
window.resizeTo(300,300)
}
</SCRIPT>
Customize as needed. :D
Er... forgot the <body scroll="no" STYLE="overflow:hidden">
me-so-sleepy
12-15-2002, 12:17 AM
.. that hasnt helped :( that is the same as the second code that i wrote down.. at least it does the same thing anyway.. i dont want the control panel an status bars..
Dalsor
12-15-2002, 12:20 AM
Sorry, I read the post a little more closely and noticed some things missing. Gimme a few to grep around and if no one else has replied, I'll see what I can come up with.
Dalsor
12-15-2002, 12:23 AM
Check out this link. Should give you all you need to make the window look as you wish it to.
http://illinois.online.uillinois.edu/stovall/js/methods.html
me-so-sleepy
12-15-2002, 12:30 AM
oke i checked out that site.. and i tried some of the like different um controls and options for a new window.. but that is for if i want a link that will open a new window.. i dont.
the window will open its self by using 'autorun' off a CD i want it to be in the form of what it will be like if i had just clicked on a link..
cheesebagpipe
12-15-2002, 01:05 AM
<script type="text/javascript">
var autowin = null;
onload = function() {
var w = 500; //window width - adjust
var h = 500; //window height - adjust
var vertAdj = 60; //play with this to center vertically
var l = window.screen ? (screen.width - w) / 2 : 100;
var t = window.screen ? ((screen.height - h) / 2) - vertAdj : 100;
autowin = open('main.htm','autowin','width='+w+',height='+h+',left='+l+',top='+t+',status=0');
if (autowin && !autowin.closed) autowin.focus();
}
</script>
me-so-sleepy
12-15-2002, 01:28 AM
oke thats kool but the problem now is i still av a main window open.. how can i make that close? i put a timer and close thing on it but because it isnt a pop up it came up with a box saying 'are you sure you want to close..' so how do i get round this?
cheesebagpipe
12-15-2002, 01:48 AM
Every window object has an .opener property; JS checks this when commanded to close a window: if it's null, it means the window was opened, presumably, by the user from a application-related item (icon, desktop menu, etc.). If it's got a reference to another window object - the 'opener' window (which JS was run in to generate it) it'll gladly let you close it from script, since you opened it from script. So - just 'fool' JS into thinking your pop-up opened the main window, instead of the other way around:
var autowin = null;
onload = function() {
.........
.........
if (autowin && !autowin.closed) {
autowin.focus();
self.opener = autowin;
self.close();
}
}
Works IE, not all others.
glenngv
12-16-2002, 03:44 AM
Originally posted by me-so-sleepy
the window will open its self by using 'autorun' off a CD i want it to be in the form of what it will be like if i had just clicked on a link..
Since you will run the page locally in the CD...
you can control the look of the main window using IE's HTAs (http://msdn.microsoft.com/workshop/author/hta/overview/htaoverview.asp)
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.