View Full Version : simple windows
gibby
07-27-2005, 10:19 PM
I don't know what else to call them. They're like browser windows except they have no buttons or menu items, just a frame and scroll bars. An example can be found at http://particleadventure.org/particleadventure/frameless/residuale_m.html. Click on "meaning of life" at the bottom of the page and you'll see a "simple window". Anyway, what I wanted to know was how do you create one.
bushie
07-27-2005, 10:43 PM
That is done with a piece of javascript code. This is it from the page itself:-<A HREF="javascript:windowOpener('answer_life.html','Life',200,200);">meaning of life!</A What it is telling the browser to do is that when "meaning of life" is clicked, to open a new window sized 200 x 200 and show the file answer_life.html.
_Aerospace_Eng_
07-27-2005, 11:36 PM
There is a bit more to it than that. The main function is window.open which is a built in function of javascript. There is a script somewhere in that page called windowOpener.
function windowOpener(url, name, w, h) {
eval("msgWindow=window.open(url,name,'width=" + w + ",height=" + h + "');msgWindow.focus();");
}
I wouldn't advise on using that script. It uses a very old method called eval. It is rarely ever needed. Try this
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<script type="text/javascript">
function openWin(url,name,wid,hgt){
sw=(screen.width-wid)/2;
sh=(screen.height-hgt)/2;
newwin=window.open(url,name,'width='+wid+',height='+hgt+',top='+sh+',left='+sw+',scrollbars=0,menuba rs=0,toolbars=0,directories=0,location=0,address=0');
newwin.focus();
}
</script>
</head>
<body>
<a href="http://www.yahoo.com" target="_blank" onclick="openWin(this.href,'somename','400','400');return false">Some Page</a>
<a href="http://www.htmlforums.com" target="_blank" onclick="openWin(this.href,'somename','400','400');return false">Some Page</a>
</body>
</html>
This way if the user has javascript disabled the page will still open but in a full sized window instead.
burhan
01-15-2006, 09:13 AM
Please, I need to open a page without menu bar , title bar, vertical scroll bar and tool bar. The user will open this window by clicking on it’s icon on the desktop not open it by clicking its link on another page. So the required page must have these properties.
Thank you
Pegasus
01-15-2006, 11:13 AM
Use the same script as has been given. That should work.
Peg
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.