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
相关文档:
<script type="text/javascript">
window.onbeforeunload=function()
{
alert("onbeforeunload event...");
//return false;
}
</script>
<a href="#" onclick="return true;">测试1</a><br/>
<a href="javascript:void(0)" onclick="return true;">测试2</a><br/& ......
JavaScript动态加载CSS的三种方法 收藏
如果你有很多关联的CSS文件要一起加载,或者想动态的加载不同的CSS文件,那么下面的方法你一定对你有帮助。
第一种:一般用在外部CSS文件中加载必须的文件
程序代码
@import url(style.css);
/*只能用在CSS文件中或者style标签中*/
第二种:简单的在页面中加载一 ......
//获取页面数据
function getPageSize(){
var xScroll, yScroll;
if (window.innerHeight && window.scrollMaxY) {
xScroll = document.body.scrollWidth;
yScroll = window.inn ......
JavaScript方法和技巧大全
1:基础知识
1 创建脚本块
1: <script language=”JavaScript”>
2: JavaScript code goes here
3: </script>
2 隐藏脚本代码
1: <script language=”JavaScript”>
2: ......