<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>prompt</title>
<script type="text/javascript">
function discriCard(){
var UUserCard = prompt("请输入你的身份证号码");
var tmpStr= "";
var birthday= "";
var strReturn= "";
alert(0);
var birthday=document.getElementById("UUserCard ");
if (UUserCard.length==15)
{
tmpStr = birthday.substring(6, 12);
tmpStr = "19" + tmpStr;
tmpStr = tmpStr.substring(0, 4) + "-" + tmpStr.substring(4, 6) + "-" + tmpStr.substring(6);
document.write(tmpStr);
}
else {
tmpStr = birthday.substring(6, 14);
tmpStr = tmpStr.substring(0, 4) + "-" + tmpStr.substring(4, 6) + "-" + tmpStr.substring(6);
document.write(tmpStr);}
}
</script>
</head>
<body>
<input name="button" type="button" onClick="discriCard()" value="点击我,输入身份证号!" />
</body>
</html>
luofuxiang
相关分类