jquery datepicker 效果

东方镜
2023-12-01
jquery datepicker效果
<html>  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">  
<title>日期选择</title>  
  
<script type="text/javascript" src="js/jquery-1.8.2.js"></script>  
<script type="text/javascript" src="js/jquery-ui-1.9.1.custom.js"></script>  
<link type="text/css" href="css/smoothness/jquery-ui-1.9.1.custom.css" rel="stylesheet" />  
  
<!-- date picker 本地化 -->  
<script type='text/javascript' src='js/ui.datepicker-zh-CN.js'></script>  
<!--<link type="text/css" href="css/pack_datepicker.css" rel="stylesheet" /> -->
  
  
<script type="text/javascript">  
$(function(){  

    $("#sponsorDate").datepicker({  
        changeMonth: true,
		changeYear: true,  
        showOn: 'button',   
        buttonImage: 'images/calendar.gif',   
        buttonImageOnly: true,  
         minDate: '-2y', 
		 maxDate: '+2y'  
    });  
    $('#sponsorDate').datepicker('option', {dateFormat: "yy-mm-dd" });  //格式化显示时间  
	$('#sponsorDate').datepicker('setDate', new Date());//设置显示当前时间
	/*$("#sub").click(function(){
						alert($("#sponsorDate").val());
							})*/
	
	
	
	
	
      
});  
</script>  
  
</head>  
  
<body>  
 <input name="sponsorDate" type="text" id="sponsorDate" value="<% = SponsorDate %>" size="50" maxlength="50" >  
 <input type="button" id="sub" value="提交">
 </body>  
</html>  

 类似资料: