input点击隐藏显示层
http://www.corange.cn//uploadfiles/121201_84237.jpg

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Popup-Window</TITLE>
<style>
#alert {font-size:12px;border:1px solid #369;width:200px;height:50px;background:#e2ecf5;z-index:1000;position:absolute;}
</style>
<script>
function hid()
{
var myAlert = document.getElementById("alert");
myAlert.style.display = "none";
}
function onsub(name)
{
// mClose.onclick();
hid();
document.getElementById("new_one").value=name.innerHTML;
}
function new_hid()
{
hid();
}

</script>
</HEAD>
<BODY>

<Br><Br><Br>
<span id="content"><input type="text" value="" id="new_one"></span>

<div id="alert" style="display:none;">
<p><a href="javascript:void(0);" onclick="onsub(this);">www.corange.cn</a></p>
<p><a href="javascript:void(0);" onclick="onsub(this);">test2</a></p>
<p><a href="javascript:void(0);" onclick="onsub(this);">test3</a></p>
<p><a href="javascript:void(0);" onclick="onsub(this);">test4</a></p>
<p><center><span id="close" style="cursor:hand;">close</span></center></p>
</div>
<div style="width:100%;height:100%;" onclick="new_hid();"></div>
<script type="text/javascript">
var myAlert = document.getElementById("alert");
var reg = document.getElementById("new_one");
var mClose = document.getElementById("close");
reg.onclick = function()
{
myAlert.style.display = "block";
//myAlert.style.position = "absolute";
//myAlert.style.width="200px";
//myAlert.style.height="200px";
// var a = window.event.x;
// var b = window.event.y;
// alert(a+ " "+b);
myAlert.style.top=event.clientY;
myAlert.style.left=event.clientX;
}
mClose.onclick = function()
{
myAlert.style.display = "none";
}
</script>


</BODY>
</HTML>

原文地址:http://www.corange.cn/archives/2010/12/3747.html