Setting Blank Browser Window Dimensions

  • The Dave
  • Novice
  • Novice
  • User avatar
  • Posts: 15
  • Loc: Edinburgh

Post 3+ Months Ago

Hi. This is a pretty simple question, but I cant find the answer anywhere. (Well I'm not 100% sure what to be looking for)

Basically I want to know how to make it so that when a user clicks on a link (say a thumbnail to a larger picture) it opens in a new window, and the window has pre-set dimensions (ie. it is JUST big enough to fit the picture).

I am aware how to open a link in a new browser window, it is just the window sizing I need help with.

I am using Dreamweaver.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • stevef
  • Novice
  • Novice
  • stevef
  • Posts: 19
  • Loc: UK

Post 3+ Months Ago

Dave

If you want to use javascript try this

Code: [ Select ]
<script language="JavaScript">
function NewWindow(mypage, myname, w, h, scroll) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
</script>
  1. <script language="JavaScript">
  2. function NewWindow(mypage, myname, w, h, scroll) {
  3. var winl = (screen.width - w) / 2;
  4. var wint = (screen.height - h) / 2;
  5. winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
  6. win = window.open(mypage, myname, winprops)
  7. if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
  8. }
  9. </script>



Put this on the href onclick
Code: [ Select ]
onclick="NewWindow(this.href,'name','750','400','yes');return false;"


change window size to suit your needs (750 width, 400 height halved)
  • The Dave
  • Novice
  • Novice
  • User avatar
  • Posts: 15
  • Loc: Edinburgh

Post 3+ Months Ago

Thanks very much.
Ill give it a go.

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 57 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.