1.1鼠标提示框

功能:鼠标移入input,div显示 ,移出div隐藏

先确定事件:onmouseover,onmouseout

和属性:display

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Examples</title>
<meta name="description" content="">
<meta name="keywords" content="">


<link href="css1.css" rel="stylesheet" type="text/css"
charset="UTF-8">
</head>
<body>
<input type="checkbox" id="tishi" />
<div id="div1">为了您的安全</div>
<script src="js1.js"> </script>
</body>
</html>

////////////////////////css

#div1{
width:200px;
height:100px;
background:#ccc;
border:1px solid #999;
display:none;
}

///////////////////////js

var toDis=document.getElementById("tishi");
var oDiv=document.getElementById("div1");

toDis.onmouseover=function (){
oDiv.style.display="block";

}
toDis.onmouseout=function (){
oDiv.style.display="none";

};

posted @ 2018-03-03 20:15  萹豆  阅读(106)  评论(0编辑  收藏  举报