I'm getting this really stupid error that makes no sense because everything looks right. I know it's late and I may be missing something, but does anyone see something that's causing this error?

test has no properties

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<script type="text/javascript">
var test = document.getElementById('test');
var link = test.getAttribute('href');

link.onclick = window.close();

<a href="http://www.cnn.com" id="test"><img src="/i/promo.jpg" width="400" height="100" alt="" /></a>