流年web前端笔记

- 作者:forever -

流年web前端笔记

网页访问密码js:

<script type="text/javascript">   
function password() {   
var testV = 1;   
var pass1 = prompt('请输入密码','');   
while (testV < 3) {   
if (!pass1)   
history.go(-1);   
if (pass1 == "123") {//初始密码123   
alert('密码正确');   
break;   
}   
testV+=1;   
var pass1 =   
prompt('密码错误!请重新输入:');   
}   
if (pass1!="password" & testV ==3)   
history.go(-1);   
return " ";   
}   
document.write(password());   
</script>  


=================


织梦表单时间提交代码

后台添加字段

time  格式text

 <input name="time" value="" type="text"  id="mytime"  /><!-- 如不需要在前台显示的话可以修改type="hidden" -->

    <script type="text/javascript">                           
window.onload = function() {
var nowDate = new Date(); var str = nowDate.getFullYear()+"-"+(nowDate.getMonth() + 1)+"-"+nowDate.getDate()+ " "+nowDate.getHours()+":"+nowDate.getMinutes()+":"+nowDate.getSeconds();     
      document.getElementById("mytime").value=str;}       
</script>

=================


鼠标移到图片上图片放大

<style type="text/css">
#div1{
width: 200px;
height: 138px;
border: #000 solid 1px;
margin: 50px auto;
overflow: hidden;
}
#div1 img{
cursor: pointer;
transition: all 0.6s;
}
#div1 img:hover{
transform: scale(1.2);
}
</style>
 
<div id="div1">
<img src="chao99.jpg" />
</div>