javascript实现年月日的联动选择
<script type="text/javascript">
function dayChange(year,month,day){
var selectYear = document.getElementById(year);
var selectMonth = document.getElementById(month);
var selectDay = document.getElementById(day);
var y = selectYear.value,m = selectMonth.value,d = selectDay.value;
if(m==4||m==6||m==9||m==11){
if(selectDay.length == 31){
selectDay.options.remove(30);
}
if(selectDay.length == 29){
selectDay.options.add(30,30);
}
if(selectDay.length == 28){
selectDay.options.add(29,29);
selectDay.options.add(30,30);
}
}
if(m==1||m==3||m==5||m==7||m==8||m==10||m==12){
if(selectDay.length == 30){
selectDay.options.add(new Option(31,31));
}
if(selectDay.length == 29){
selectDay.options.add(new Option(30,30));
selectDay.options.add(new Option(31,31));
}
if(selectDay.length == 28){
selectDay.options.add(new Option(29,29));
selectDay.options.add(new Option(30,30));
selectDay.options.add(new Option(31,31));
}
}
if(m==2){
if(isRunYear(y)){
if(selectDay.length == 31){
selectDay.options.remove(30);
selectDay.options.remove(29);
}
if(selectDay.length == 30){
selectDay.options.remove(29);
}
if(sele
相关文档:
scrollHeight: 获取对象的滚动高度。
scrollLeft:设置或获取位于对象左边界和窗口中目前可见内容的最左端之间的距离
scrollTop:设置或获取位于对象最顶端和窗口中可见内容的最顶端之间的距离
scrollWidth:获取对象的滚动宽度
offsetHeight:获取对象相对于版面或由父坐标 offsetParent 属性指定的父坐标的高度
offsetL ......
一、基本使用方法
prototype属性可算是JavaScript与其他面向对象语言的一大不同之处。
简而言之,prototype就是“一个给类的对象添加方法的方法”,使用prototype属性,可以给类动态地添加方法,以便在JavaScript中实现“继承”的效果。
& ......
JavaScript基础
stringObject.charAt(index)方法:返回指定索引位置处的字符。
stringObject.slice(start,[end])和stringObject.substring(start,[end])方法都接受两个参数,分别为子字符串的起始位置和终止位置,返回这两者之间的字符串,不包括终止位置的那个字符串。如果不指定第二个参数,则默认为字符串的长度,即 ......
1) 为什么加载javascript文件很重要?
javascript文件是比较特殊的,因为浏览器加载javascript是串行的。以为着在加载Javascript文件的时候,其他一切资源的下载包括页面的显示都会被阻塞。
2) 如何正确的加载JavaScript?
a. 将JavaScript文件放在页面的最后
因为JavaScript的加载会阻塞页面的显示,所以将JavaScrip ......