Link to home
Start Free TrialLog in
Avatar of sabecs
sabecs

asked on

JavaScript - open a new window from button click

Hi,
I can't work out how to open a new window 900px wide by 800px high when the button is clicked?


<input name="button" type="button" class="formbutton_admin" id="button" onClick="javascript:preview_template(document.getElementById('template_name').value,document.getElementById('template_style').value)" value="Preview Template">


<script type="text/javascript">

function preview_template(name,style){      
            var name = name;
             var style = style;
            self.location = "preview.php?template_name="+name+"&style="+style;
}

 function MM_openBrWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}

</script>

Your comments and feedback would be appreciated.
Avatar of chrios
chrios
Flag of Sweden image

Have a look at this link and see if it's of help to you.

http://javascript.internet.com/generators/popup-window.html
Try below code:

<input name="button" type="button" id="button" onclick="window.open('HTMLPage1.htm', 'Template', 'width=900px, height=800px');" value="Preview Template" />

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of sajjadz
sajjadz

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sajjadz
sajjadz

sorry, use "Preview Template" instead of "Ok" in button value
Avatar of sabecs

ASKER

Thanks  sajjadz, its perfect..