Click to See Complete Forum and Search --> : window properties


riot_girl
12-01-2002, 11:03 AM
hey there. just had a quickie.

I want to open a new window without all the crap directories, status bar, scrollbars, etc. (it's linked to a picture you click on). I'd like to not use java if i can avoid it, so i thought id ask you guys - i gave it a shot, but obviously screwed it up, cos it won't work.

So i'd really, truly apprectiate the whole code written out if it's not a massive hassle... i just need the obvious pointed out :o)

Zach Elfers
12-01-2002, 02:18 PM
You can't open a window with just HTML. You have to do it with JavaScript. If you don't want all the window properties, make you window script like this:

<script language="JavaScript" type="text/JavaScript">
<!-- Begin

function newWindow() {
newWin = window.open("","Your windows title","width=whatever,height=whatever,scrollbars=no,menubar=no,status=no,toolbar=no,resizable=no");
newWin.document.write("Your new Windows contents");
newWin.focus();
}

// End -->
</script>

<a href="javascript:newWindow();">Open New Window</a>

That will give you a window without all the menu's added to it and stuff.:)

Stefan
12-01-2002, 06:16 PM
Originally posted by Zach Elfers
<a href="javascript:newWindow();">Open New Window</a>


That code breaks the link if JS is not available, not to mention that it is incorrect JavaScript.

Try
<a href="imagelocation" target="_blank" onclick="newWindow(); return false;">Open New Window</a>

That will make it work in all browsers at least partially.

riot_girl
12-01-2002, 06:20 PM
hey hey ther. thanks for helping me out. i dont know what the flop i'm doing wrong, but it wont even open a new window now.

would you mind having a look at my page for me??

http://www.geocities.com/aribanana/leslie/theband.htm

just that pic you click on is meant to open a new window with none of the scrollbar toolbar crap - but i've stuffed it up somehow. : o(

Zach Elfers
12-01-2002, 07:24 PM
That space in between the java and script (java script) is an error. I don't know what's happening. I went to edit that thinking it was a mistake I made but the words were together and it still appeared that way. When you write your code take the space out.

Stefan
12-02-2002, 06:10 AM
Originally posted by Zach Elfers
That space in between the java and script (java script) is an error.

No the error is to use that Javascript: AT ALL. It's neighter needed nor correct.

This works as it should, girl. It's possible that other broken stuff on your page messes something up.
So start with this code example and add the rest of your page to it.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<meta http-equiv="Content-Style-Type" content="text/css">
<title>JS popup</title>
<script type="text/javascript">
function newWindow() {
window.open('test.html','winname','toolbar=no,status=no,scrollbars=no,location=no,menubar=no,directo ries=no,resizable=no,width=640,height=480');
}
</script>
</head>
<body>

<a href="test.html" target="_blank" onclick="newWindow();return false;">Open New Window</a>

</body>
</html>

Charles
12-02-2002, 06:24 AM
Let me just add that if you specify any part of the window geometry, say height and width, then the other parts default to 'no'. You never need to write toolbar=no. See http://developer.netscape.com/docs/manuals/js/client/jsref/window.htm#1202731 for window geometry deails.