style
06-06-2005, 09:35 PM
what sort of java coding would i use to make my website open up in a window with a set size of 800*600?
any help would be much appreciated as usual
thanks
cbscreative
06-07-2005, 03:31 AM
Here is the code, read the notes.
<a href="page.htm" title="This page will open in a new window" onclick="NewWindow=window.open
('page.htm','NewWindow','toolbar=no,location=no,
directories=no,status=yes,menubar=no,scrollbars=ye s,
resizable=yes,width=800,height=600'); return false;">
The href= will make it work for the users without javascript enabled, usually around 10% of users. I recommend always allowing for users without scripts enabled. The page.htm is repeated in the script. The NewWindow name must match the name stated in the onclick=. The width and height can be set to anything desired, the rest of the commands are used if you want toolbars, scrollbar, etc. Just change each to yes or no to see the effect.
Personally, I recommend going less than 800x600 so users with that setting will instantly know they have a new window. Also, make sure it is necessary to use a new window. Some users are annoyed by it, but since it can be used as a convenience, it is a trade-off. Be aware that popup killers can also cause problems too.
All in all, the rule to always make sure your site works without scripts enabled is a recommended design strategy. You may want to get a book or check out sites such as hotscripts.com. The advice about providing alternatives will help with scripts that blow up in some browsers. The one here is simple and cross compatible, but you will find that not to be true with the fancier ones.
Steve
www.cbscreative.com (http://www.cbscreative.com)
PS: Had to edit for display, there are no spaces in anything inside the parenthesis, it is broken up because of the display in this post.
style
06-07-2005, 02:05 PM
thanks a lot for your help!! will try it out soon