child = window.open("child.html");
<html><head><title>close window test</title>
<div onclick="say_hi();">click here to open child window</div>
<div onclick="say_bye();">click here to close child window</div>
If you remember check back tomorrow. I'll post code that I have (that doesn't work) and hopefully you'll be able to point out why.
Alternatively you can give the tag an id (eg. <div id="open">) and then add the onclick using
document.getElementById('open').onclick = say_hi;
I was making an example to post here and I got it to work. I gave a link in the popped up window an id and assigned a function to that id to run self.close().