|
|
|
เมื่อคลิกที่ไอคอนปฏิทินทั้งสองอัน แล้วให้ระบบคำนวณระยะเวลาอัตโนมัติต้องทำไงค่ะ |
|
|
|
|
|
|
|
Code (PHP)
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="jquery-ui-1.8.4.custom.min.js"></script>
<script type="text/javascript">
$(function(){
// Datepicker
$('.datepicker').datepicker({
dateFormat: 'yy-mm-dd',
changeYear: true,
changeMonth: true,
buttonImageOnly: true,
buttonText: 'เลือกวันที่',
showOn: 'button',
buttonImage: 'images/cal.gif', //image
duration: 'fast'
});
$("img[src$='images/cal.gif']").mouseover(function() {$(this).css('cursor','pointer');});
});
</script>
<p>
<input type="text" id="start_date" name="start_date" value="" class="datepicker" />
<input type="text" id="end_date" name="end_date" value="" class="datepicker" />
</p>
<br/>
<input type="text" name="txttime_d_p" style="width:200px;height:18px" value="" />วัน
|
|
|
|
|
Date :
2011-05-26 16:02:21 |
By :
kalakate |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ไม่รู้จะ ERROR หรือเปล่านะ
Code (PHP)
<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
<style type="text/css">body{ font: 90.0% "Tahoma", sans-serif; margin: 50px;}</style>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/swanky-purse/jquery-ui.css" media="screen" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js"></script>
<script type="text/javascript">
var datepicked = function() {
var from = $('#from');
var to = $('#to');
var days = $('#days');
var fromDate = from.datepicker('getDate')
var toDate = to.datepicker('getDate')
if (toDate && fromDate) {
var difference = 0;
var oneDay = 86400000; //ms per day
var difference = Math.ceil((toDate.getTime() - fromDate.getTime()) / oneDay);
days.val(difference);
}
}
$(function() {
$('#from, #to').datepicker({
onSelect: datepicked
});
});
</script>
</head>
<body>
<div class="form">
<label for="from">From</label>
<input type="text" id="from" name="from"/>
<label for="to">to</label>
<input type="text" id="to" name="to"/>
<label for="days">days</label>
<input type="text" id="days" name="days"/>
</div>
</body>
</html>
|
|
|
|
|
Date :
2011-05-26 18:57:46 |
By :
deawx |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณค่ะ
|
|
|
|
|
Date :
2011-05-27 12:09:08 |
By :
kalakate |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
แล้วถ้าต้องการ เดือน กับ ปี ต้องทำยังไงหรอครับ รบกวนหน่อยครับ
|
|
|
|
|
Date :
2011-06-15 16:22:09 |
By :
phionixz |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|