CSS
#apDiv1 {
position:absolute;
left:863px;
top:201px;
width:59px;
height:47px;
z-index:1;
}
#btftopbar {
height:30px;
width:auto;
background: #005094 url('..');
background-repeat:repeat-x;
text-align:left;
padding-top:4px;
padding-top:20px;
}
#adsground {
height:400px;
margin:0 auto;
width: 700px;
background:#e5e5e5;
border-bottom:2px #005094 solid;
border-right:2px #005094 solid;
border-left:2px #005094 solid;
text-align:center;
padding:4px;
}
#headlineatas {
opacity:1.0;
height:auto;
width:auto;
position:fixed;
top:65px;
left:200px;
border-bottom:1px #005094 solid;
border-bottom:0px blue solid;
color:#333;
padding:0px;
z-index:1001;
font-size:13px;}
#apDiv2 {
position:absolute;
left:907px;
top:208px;
width:247px;
height:300px;
z-index:1;
background-color: #999999;
}
#apDiv2 {
color: #F00;
}
#apDiv3 {
position:absolute;
left:330px;
top:216px;
width:361px;
height:244px;
z-index:2;
}
JS
function getValue()
{
document.getElementById("headlineatas").style.display = 'none';
}
HTML
<div id="headlineatas">
<div id="btftopbar">
<img align="left" style="padding-right:2px;" src="http://4.bp.blogspot.com/-vzd4PC3mEFk/T-sufsJgLxI/AAAAAAAAAN4/knJUIQkvjtE/s300/blogtariff.com.png" />
<span style="color:#fff;font-size:13px;font-weight:bold;text-shadow:black 0.1em 0.1em 0.1em">Hi ..! Like us then Close</span>
<span style="color:#fff;font-size:13px;font-weight:bold;text-shadow:black 0.1em 0.1em 0.1em;float:right;padding-top:340px;padding-right:-5px">
<b>
<a onclick="getValue()">x</a></b></span>
</div>
<div id="adsground">
<center>
<b><a class="KBTricks"><h3>Hi Friends Like US </h3> Don't Forget To Join With Our Community</a></b>
<center>
<iframe src=""></iframe>
<iframe src=""></iframe>
<div id='close' style="float:right; overflow:hidden;font-style:bold;">
<h1>
<b> Like us & Close Here>>>>>> </b></h1> </br>
</div>
</center></center></div></div>
</div>
Instead of clicking the "X" to hide the div, I want to edit the code so that when a user clicks outside of the div, it will automatically hide. I have tried various tutorials but have been unsuccessful in implementing this feature.