小程序的功能:在输入框里打字的时候提示信息隐藏,当删除输入内容的时候提示信息自动出现,鼠标焦点获取:点提示信息的时候同样获取焦点。
截图:
源代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>
.search{
width: 350px;
height: 30px;
margin: 100px auto;
position: relative;
}
.search input{
width: 200px;
height: 25px;
}
.search label{
font-size: 12px;
color: #CCCCCC;
position: absolute;
top: 8px;
left: 20px;
cursor: text;
}
</style>
<script>
window.οnlοad=function(){