Hi Sluggers:
Objective: When someone clicks on a link, I want a new browser window to open with no toolbars, menubar. I want scrollbars. I know Javascript has window.open() to achieve what I want. However the new window opens up from a <a> tag from a script. I tried window.open() in the <a> tag but it did not work. I have also tried this in the ".html" file I want to open up in the new resized browser window with no menu and toolbars.
Javascript: window.open(<url>,<title>,<options>)
<options> amongst other things could be: "menubar=no,personalbar=no,resizable=yes,scrollbars=yes,width=300,height=300,left=" + l + ",top=" + t);
where l and t are the calculated left and top coordinates to put a 300x300 window in the middle of the screen.
To call a javascript function from an <a> tag, you MUST return false so that the link is not activated, eg:
<a href="" onclick="openWindow(); return false;">Something here</a>
Also, with window operations, particularly sizing, be careful what object parameters you use - Internet Explorer uses some non-standard ones.
I have this sample Javascript in the <head> tag
<script> function resizeWindow(width,height){ if (document.layers) { // resizeTo sets inner size, so use this instead window.outerWidth = width; window.outerHeight = height; } else window.resizeTo(width,height); } </script>
Now in my <body> tag I have added this
<body .... onload="resizeWindow(300,300);">
This of course just resizes the window. But it still leaves the toolbars and menu bars. Any ideas on how I can extend the above script with a window.open() or something similar would be greatly appreciated.
Cheers.
-- Phil Scarratt Draxsen Technologies IT Contractor 0403 53 12 71
-- SLUG - Sydney Linux User's Group - http://slug.org.au/ More Info: http://lists.slug.org.au/listinfo/slug
