<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script type="text/javascript">
window.onload = function(){
function $(id){return document.getElementById(id);}
$("btn").onclick = function(){
if ($("txt").value == "刘德华") {
alert("恭喜"); }
else{
alert("再接再厉");
}
}
}
</script>
</head>
<body>
<input type="text" id="txt" value="请输入.."><button id="btn">查询</button>
</body>
</html>