[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 196
  • Last Modified:

Setting size for new window

How would I create a new window with a set size and without the navigation buttons?
0
kch011099
Asked:
kch011099
1 Solution
 
mayhewCommented:
Try this:




<form name="myform">
  <input type="button" name="go" value="Go" onclick="ShowWindow()">
</form>


<script language=javascript>
function ShowWindow(){
  MyWindow = window.open("http://www.microsoft.com","MessageWindow","toolbar=no,height=250,width=250")
}
</script>



MyWindow is a variable that you can use to reference the new window in your javascript.

The first argument in the function is the URL.

The second is that name of the new window.

The third argument is a string that holds all of your options.  Height and width are in pixels.


It should be noted that you don't have to create a seperate function to open the window.  I just did it that way to try to give a complete solution.

A shorter version could be:


<form name="myform">
  <input type="button" name="go" value="Go" onclick='window.open("http://www.microsoft.com","MessageWindow","toolbar=no,height=250,width=250")'>
</form>


Note the alternating single and double quotes after the onclick.


Let me know if this answers your question.
0
 
srividya_krisCommented:
mayhew has provided U the almost complete answer.
If U want to avoid creating a page with only a button control U can call the js function  show_window() on "onload" event of the <body> tag of the page.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now