`
vanillalyx
  • 浏览: 62437 次
  • 性别: Icon_minigender_2
  • 来自: 北京
社区版块
存档分类
最新评论

辅导员管理系统开发 笔记

阅读更多

//功能:复制一行,这一行具有class='tr_data' 并且隐藏起来
    function addTr(){
    	var o = $(".tr_data").eq($('.tr_data').length - 1)
    	.clone() // 复制第一行
    	.insertBefore($('.tr_data').eq($('.tr_data').length - 1));
	    o.show();
	   	o.find('.year').each(function(){
	   		addYearList(this);
	   	});
	   	o.find('.month').each(function(){
	   		addMonthList(this);
	   	});
	   // initTimeSelection();//初始化年月
    }
    //功能:删除一行,这一行具有class='tr_data',剩下一行时不能删除
    function delTr(){
    	$(".tr_data").eq($('.tr_data').length - 2).remove(); //删除最后一行
    }
分享到:
评论
2 楼 vanillalyx 2009-05-13  
wrong example
这是原来的代码,提交之后如果有错,填写内容会消失
<form  id="myForm" >
<input type="text" id="input1">
<input type="submit" value="submit" onClick="checkForm()">
</form>
<script type="text/javascript">
function checkForm(){
	if(document.getElementById('input1').value == 'right'){
		alert('right,成功提交');
		return true;
	}else{
		alert('wrong ! you should write "right"');
		return false;
	}
}
</script>

<hr/>

right example 这是我修改之后的,提交之后如果有错,填写内容不会消失
<form  id="myForm2" onSubmit="return checkForm1();" >
<input type="text" id="input2">
<input type="submit" value="submit" >

</form>
<script type="text/javascript">
function checkForm1(){
	if(document.getElementById('input2').value == 'right'){
		alert('right,成功提交');
		return true;
	}else		{
		alert('wrong ! you should write "right"');
		return false;
	}
}
</script>
1 楼 vanillalyx 2009-04-04  

//not use 2008年12月23日
function initTime(){
	$('.year').each(function(){
		addYearList(this);
	});
	$('.month').each(function(){
		addMonthList(this);
	});
	
}

相关推荐

Global site tag (gtag.js) - Google Analytics