页面右下角温馨小提示

27. December 2015 HTML5 0

<script language=”javascript”>

function fixeds(){
var s=document.getElementById(“fixeds”);
s.style.display=’none’;
}

</script>

<div id=”fixeds” style=”width:300px; height:200px; background-color:#009; position:fixed; right:0px; bottom:0px; background-image:url(images/day.jpg); background-position:center; background-size:100% 100%”>

<label id=”dayss” style=” display:block;margin-top:30px; margin-left:50px; text-align:center; width:200px; height:30px;”></label>

</div>

——————————————————————————————–

另外要是放在JS单独页面下面代码这样子存放

window.onload=tab;
function tab(){
var strs;
var mydate = new Date();
var hour= mydate.getHours();
if(hour>=0 && hour<=5 || hour>=22 && hour<=23){
strs = “夜深了,记得早点休息哦!”
}
else if(hour>=6 && hour<=8){
strs = “早晨好,早安!”;
}
else if(hour>=9 && hour<=12){
strs = “上午好,精力充沛,记得工作哦!”;
}
else if(hour>=13 && hour<=18){
strs = “下午好,记的喝杯下午茶哦!”;
}
else {
strs = “晚上好,稍微放松一下不错哦!”;
}
document.getElementById(“dayss”).innerHTML=strs;
setInterval(function(){
document.getElementById(“fixeds”).style.display=’none’;
},4000);
}


Leave a Reply

Your email address will not be published. Required fields are marked *