首页 > 代码库 > 与其放在电脑里占内存,还不如拿出来帮助一群小白白之html篇之五

与其放在电脑里占内存,还不如拿出来帮助一群小白白之html篇之五

<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script type="text/javascript">
/* var str="cheghao";
var reg=/./;
alert(reg.test(str));

var phone="dfdf";
var reg=/\D/;
alert(reg.test(phone));

var phone="fdf";
var reg=/\d/;
alert(reg.test(phone));

var phone="fdf ";
var reg=/\s/;
alert(reg.test(phone));
*/
/*
var arr=[];
arr[0]=1;
arr[1]=3;
arr[2]="a";
arr[4]=true;
for(var index in arr){
document.write(arr[index]+"<br/>");
}
var arr=[];
arr[0]=1;
arr[1]=3;
arr[2]="a";
arr[4]=true;
for(var str in arr){
document.write(str+"<br/>");
}*/
/* var d1=new Date();
document.write(d1.toString ()+"<br/>");
var d2=new Date("2010-10-01 11:01:36");
document.write(d2.toString ()+"<br/>");
var d3=new Date("2010,10,11");
document.write(d3.toString ()+"<br/>");
*/
/* var d1=new Date();
var year=s1.getFullYear ();
var month=d1.getMonth ()+1;
var date=d1.getDate ();
var day=d1.getDay ();
switch (day){
case 0:
day="星期日";
break ;
case 1:
day="星期一";
break ;
case 2:
day="星期二";
break ;
case 3:
day="星期三";
break ;
case 4:
day="星期四";
break ;
case 5:
day="星期五";
break ;
case 6:
day="星期六";
break ;
}
document.write("今天是:"+year+"年"+month +"月"+date+"日"+day );
*/
function testConfirm(){
var answer=window.confirm ("是否确认退出?");
if(answer){
window.close ();
}else
{
window.alert(":-)");
}

 

}
function testprompt(){
var answer=window.prompt ("请输入密码:","123");
alert(answer );
}


</script>
</head>
<body>
<input type="button" value="http://www.mamicode.com/testConfirm" onclick="testConfirm()">
<input type="button" value="http://www.mamicode.com/testprompt" onclick="testprompt()">

 

</body>
</html>

与其放在电脑里占内存,还不如拿出来帮助一群小白白之html篇之五