<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<script type="text/javascript" src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
<style type="text/css">
input {
width: 100px;
height: 30px;
}
li {
list-style-type: none;
padding-top: 10px;
}
.modal {
position: fixed;
z-index: 99999;
background-color: rgb(0, 0, 0, 0.5);
border: 2px solid red;
border-radius: 26px;
width: 180px;
height: 50px;
font-size: 14px;
color: white;
text-align: center;
display: none;
line-height: 50px;
left: 50%;
top: 30%;
}
</style>
</head>
<body>
<ul>
<li>
<input type="button" value="第一个按钮" />
</li>
<li>
<input type="button" value="第二个按钮" />
</li>
<li>
<input type="button" value="第三个按钮" />
</li>
</ul>
<!--弹出层start-->
<div class="modal"></div>
<!--弹出层end-->
<script type="text/javascript">
function showMessage(data) {
$('.modal').html(data);
$('.modal').fadeIn();
setTimeout(function () {
$('.modal').fadeOut();
}, 2000);
};
$(':input').click(function () {
var text = $(this).val();
showMessage(text);
});
</script>
</body>
</html>