View Full Version : Simple Javascript question.
brutfood
June 5th, 2002, 11:33
I want to open a window, with no borders, no toolbars etc, to a specific size.
I found this code:-
<script language="JavaScript">
<!--
function winPop()
{
window.open("mypage.html","_self","toolbar=no,menubar=no,directories=no,location=no,status=no,
scrollbars=no,resizable=no,width=550,height=425");
}
//-->
</script>
And just need to know how to call it so that the window containing this code, is replaced by my new borderless window (mypage.html). Also, I think I read that there are limits to width and height?
Sorry, although I learnt C++, I've never messed around with javascript to get the hang of the syntax and conventions.
ashben
June 5th, 2002, 11:50
If you want to open the window on the click of a button ..
<input type="button" onClick="javascript:winPop();">
If you want to open the window on the click of an image ..
<a href="" onClick="javascript:winPop(); return false;"><img ... ></a>
If you want to open the window automatically on page load ..
<body onLoad="javascript:winPop();">
Hope it helps.
ashben
June 5th, 2002, 11:51
Also, the main javascript code must be between the head tags.
guitarnerd
June 6th, 2002, 06:20
If you are having problems with the JS running, and have another JS file in there make sure you are using the correct Body onload procedure
brutfood
June 7th, 2002, 09:24
Thanks for that - It works nicely.
But one small detail.
I'm opening the borderless windows when a button is pressed (the button is in Flash, but that's not an issue). If I press a button, but the window is already there - I get scrollbars.
Can I prevent that?
To see what I'm doing, go to:-
http://au.geocities.com/brutfood/
And Launch a palette in my Darg and Drop WEB page maker.
Meksilon
June 10th, 2002, 09:58
Originally posted by brutfood
Thanks for that - It works nicely.
But one small detail.
I'm opening the borderless windows when a button is pressed (the button is in Flash, but that's not an issue). If I press a button, but the window is already there - I get scrollbars.
Can I prevent that?
To see what I'm doing, go to:-
http://au.geocities.com/brutfood/
And Launch a palette in my Darg and Drop WEB page maker. I can do it... can you?
You currently have
window.open("mypage.html","_self","toolbar=no,menubar=no,directories=no,location=no,status=no,
scrollbars=no,resizable=no,width=550,height=425");
Which has borders. You want none? try:
var newWin=window.open("mypage.html","_self","fullscreen=1");
newWin.width=550
newWin.height=425
you can even position it with newWin.Left and newWin.Top
have fun,
=mek=
Powered by vBulletin® Version 4.1.7 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.