1.生日算年龄
<SCRIPT LANGUAGE="JavaScript">
<!--
function getAge(birth){//参数为出生年月,如1980/5/9
var now=new Date();
var old=new Date(birth);
//alert(now)
alert(" 此人年龄为"+(now.getFullYear()-old.getFullYear())+"岁");
alert("天数为"+Math.round(Math.abs(old.getTime()-now.getTime())/(24*60*60*1000))+"天");
}
//-->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!--
function getAge(birth){//参数为出生年月,如1980/5/9
var now=new Date();
var old=new Date(birth);
//alert(now)
alert(" 此人年龄为"+(now.getFullYear()-old.getFullYear())+"岁");
alert("天数为"+Math.round(Math.abs(old.getTime()-now.getTime())/(24*60*60*1000))+"天");
}
//-->
</SCRIPT>
<html>
<head>
<script language=JavaScript>
function eyun(v)
{if(v==2)
dia_pass.style.display="";
else
dia_pass.style.display="none";
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head><body> <table width="500" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="56" colspan="3">
<p>
<select onchange="eyun(this.value)">
<option value=1>无</option>
<option value=2>有</option>
</select>
</p>
<input name="dia_pass" type="password" style="display:none">
</td>
</tr>
</table>
</body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head><body>
<p>
<input type="radio" name="rb1" value="1" onClick="change()">
Y<input type="text" name="text1" readonly="true">
<input type="radio" name="rb1" value="2" onClick="change()">
N<input type="text" name="text2"readonly="true">
</p></body>
</html>
<script language="javascript1.1">
function change(){
var radios = document.all("rb1");
if(radios[0].checked){
document.all("text1").readOnly = false;
document.all("text2").readOnly = true;
}
if(radios[1].checked){
document.all("text1").readOnly = true;
document.all("text2").readOnly = false;
}
}</script>