Outils pour utilisateurs

Outils du site


devweb:jquery:datepicker (lu 8974 fois)

Ceci est une ancienne révision du document !


Datepicker

exemple pour gérer des dates

	$('#camera_next').click(function(){
		if($('#heure option:selected').next().val()==undefined){
			heure='0300';
			date_photo=$( "#date_photo" ).datepicker('getDate');
			jour=$.datepicker.formatDate( "yymmdd", new Date(date_photo.getFullYear(), date_photo.getMonth(), date_photo.getDate()+1 ) );
 
			$("#date_photo").datepicker('setDate',$.datepicker.formatDate( "dd/mm/yy", new Date(date_photo.getFullYear(), date_photo.getMonth(), date_photo.getDate()+1 ) ) );
			$("#heure").val(heure);
		}else{
			d=$('#date_photo').val();
			jour=d.substr(6,4)+d.substr(3,2)+d.substr(0,2);
			heure=$('#heure option:selected').next().val();
 
			$("#heure").val(heure);			
		}
		$('#photoreel').attr('src','http://transalpair.eu/smm/photos/Pict_'+jour+'_'+heure+'.jpg');
		$('#photolien').attr('href','http://transalpair.eu/smm/photos/Pict_'+jour+'_'+heure+'.jpg');
	});
 
	$('#camera_prev').click(function(){
		if($('#heure option:selected').prev().val()==undefined){
			heure='2100';
			date_photo=$( "#date_photo" ).datepicker('getDate');
			jour=$.datepicker.formatDate( "yymmdd", new Date(date_photo.getFullYear(), date_photo.getMonth(), date_photo.getDate()-1 ) );
 
			$("#date_photo").datepicker('setDate',$.datepicker.formatDate( "dd/mm/yy", new Date(date_photo.getFullYear(), date_photo.getMonth(), date_photo.getDate()-1 ) ) );
			$("#heure").val(heure);
		}else{
			d=$('#date_photo').val();
			jour=d.substr(6,4)+d.substr(3,2)+d.substr(0,2);
			heure=$('#heure option:selected').prev().val();
 
			$("#heure").val(heure);			
		}
		$('#photoreel').attr('src','http://transalpair.eu/smm/photos/Pict_'+jour+'_'+heure+'.jpg');
		$('#photolien').attr('href','http://transalpair.eu/smm/photos/Pict_'+jour+'_'+heure+'.jpg');
	});
devweb/jquery/datepicker.1394440363.txt.gz · Dernière modification: 10-03-2014 09:32 de edmc73