HTML and CSS Reference
In-Depth Information
Here's an invalid list of settings:
status=off, toolbar=off, location=false, top=100
Including spaces (or carriage returns) anywhere in your list will cause problems. It's also
worth noting that when you provide settings for a new window, the browser automati-
cally assumes a default of off for any on/off settings that you don't include. So, you can
leave out anything you want to turn off.
Here's a complete example that uses JavaScript to create a new window:
<!DOCTYPE html>
<title> Popup example </title>
<script type=”text/javascript”>
function popup(url) {
var mywindow =, 'name', 'height=200,width=400');
return false;
<h1> Popup Example </h1>
<a href=”popup.html” onclick=”popup(this.href)”> Launch popup </a>
When a user clicks the Launch popup link, a new 200x400 pixel window appears with
the contents of popup.html .
The unobtrusive approach is to skip the onclick attribute entirely and bind the popup()
function to the link in your JavaScript code. First, change the link on the page to look
like this:
<a href=“popup.html” id=”launchpopup”> Launch popup </a>
Then you should edit the <script> tag so that it looks like this:
<script type=”text/javascript”>
function popup(url) {
var mywindow =, 'name', 'height=200,width=400');
return false;
window.onload = function () {
var link = document.getElementById(“launchpopup”);
link.onclick = function () {
return popup(this.href);
Search WWH ::

Custom Search