JavaScript and client side scripting.
Moderator: General Moderators
mekha
Forum Contributor
Posts: 112 Joined: Sat Mar 31, 2012 6:50 am
Post
by mekha » Mon Aug 06, 2012 2:04 am
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<input type="button" value="Close this window" onclick="self.close()">
</body>
</html>
why my code doesnt work ?
califdon
Jack of Zircons
Posts: 4484 Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA
Post
by califdon » Mon Aug 06, 2012 4:03 pm
Try onclick="window.close();"
tr0gd0rr
Forum Contributor
Posts: 305 Joined: Thu May 11, 2006 8:58 pm
Location: Utah, USA
Post
by tr0gd0rr » Wed Aug 08, 2012 2:00 pm
Is this a pop-up window? I don't think you can close a tab using self.close() or window.close(). Also, avoid the xhtml doctype these days. Instead start with