|
 |
|
อยากถามเรื่องเก็บค่ามาแล้วโชว์ค่าวันที่ ถึงวันที่ ช่วยทีครับผมงงมากครับ |
|
 |
|
|
 |
 |
|
จะให้ช่วยยังไงครับ 
|
 |
 |
 |
 |
Date :
2012-06-09 21:57:34 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เอาโค้ดมาลงดีกว่าครับ
|
 |
 |
 |
 |
Date :
2012-06-09 22:16:43 |
By :
deawx |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (JavaScript)
<script language="JavaScript">
function fncSum()
{
var i = document.form_cust.date_a_1.value.split("-");
var j = document.form_cust.date_a_2.value.split("-");
var k = document.form_cust.date_b_1.value.split("-");
var l = document.form_cust.date_b_2.value.split("-");
var m = document.form_cust.date_c_1.value.split("-");
var n = document.form_cust.date_c_2.value.split("-");
var o = document.form_cust.date_d_1.value.split("-");
var p = document.form_cust.date_d_2.value.split("-");
function monthDiff(d1, d2) {
var months;
months = (d2.getFullYear() - d1.getFullYear()) * 12;
months += d2.getMonth() + 1;
months -= d1.getMonth();
return months;
}
document.form_cust.down_1.value = monthDiff(
new Date(i[2],i[1],i[0]),
new Date(j[2],j[1],j[0]));
document.form_cust.down_2.value = monthDiff(
new Date(k[2],k[1],k[0]),
new Date(l[2],l[1],l[0]));
document.form_cust.down_3.value = monthDiff(
new Date(m[2],m[1],m[0]),
new Date(n[2],n[1],n[0]));
document.form_cust.down_4.value = monthDiff(
new Date(o[2],o[1],o[0]),
new Date(p[2],p[1],p[0]));
}
</script>
<tr>
<td>ขยักที่ 1. วันที่ : <input type="text" id="date_a_1" name="date_a_1" size="7" class="validate[required]" > ถึงวันที่ <input type="text" id="date_a_2" name="date_a_2" size="7" class="validate[required]" >
จำนวนงวด : <input type="text" name="down_1" readonly="readonly" onkeyup='checkNumber(this)' size="1" class="validate[required]"> จำนวนเงินต่องวด : <input type="text" name="price_pon_down_a" onclick="fncSum()" OnChange="JavaScript:chkNum(this)" onkeyup='checkNumber(this)' size="11" class="validate[required]" > บาท
</td>
</tr>
<tr><td> </td></tr>
<tr>
<td>ขยักที่ 2. วันที่ : <input type="text" id="date_b_1" name="date_b_1" size="7" class="validate[required]" > ถึงวันที่ <input type="text" id="date_b_2" name="date_b_2" size="7" class="validate[required]" >
จำนวนงวด : <input type="text" name="down_2" readonly="readonly" onkeyup='checkNumber(this)' size="1" class="validate[required]"> จำนวนเงินต่องวด : <input type="text" name="price_pon_down_b" onclick="fncSum()" OnChange="JavaScript:chkNum(this)" onkeyup='checkNumber(this)' size="11" class="validate[required]" > บาท
</td>
</tr>
<tr><td> </td></tr>
<tr>
<td>ขยักที่ 3. วันที่ : <input type="text" id="date_c_1" name="date_c_1" size="7" > ถึงวันที่ <input type="text" id="date_c_2" name="date_c_2" size="7" >
จำนวนงวด : <input type="text" name="down_3" readonly="readonly" onkeyup='checkNumber(this)' size="1"> จำนวนเงินต่องวด : <input type="text" name="price_pon_down_c" onclick="fncSum()" OnChange="JavaScript:chkNum(this)" onkeyup='checkNumber(this)' size="11" > บาท
</td>
</tr>
<tr><td> </td></tr>
<tr>
<td>ขยักที่ 4. วันที่ : <input type="text" id="date_d_1" name="date_d_1" size="7" > ถึงวันที่ <input type="text" id="date_d_2" name="date_d_2" size="7" >
จำนวนงวด : <input type="text" name="down_4" readonly="readonly" onkeyup='checkNumber(this)' size="1"> จำนวนเงินต่องวด : <input type="text" name="price_pon_down_d" onclick="fncSum()" OnChange="JavaScript:chkNum(this)" onkeyup='checkNumber(this)' size="11" > บาท
</td>
</tr>
หน้านี้รับค่ามาใช้คำนวนเรียบร้อยแล้วจะส่งค่าไปหน้าต่อไป $_POST จากหน้านี้แล้ว ได้ค่าเดือนเท่าไรถึงเดือนเท่าไรห่างกันกี่เดือนผมอยากให้ออกเป็นประมาณนี้ครับ
05 มิ ย 2555 ผ่อนเป็นเงิน 7,000
05 ก ค 2555 ผ่อนเป็นเงิน 7,000
05 ส ค 2555 ผ่อนเป็นเงิน 7,000
05 ก ย 2555 ผ่อนเป็นเงิน 7,000
05 ต ค 2555 ผ่อนเป็นเงิน 7,000
คือผมอยากทราบว่าพอจะใช้ date ของ php คำนวนวันออกมาได้เลยไหม code ประมาณไหนครับ ผมไปติดตรงที่เมือเกินปีจะไปคำนวนยังไงครับผม
|
ประวัติการแก้ไข 2012-06-09 23:50:27 2012-06-10 10:23:55
 |
 |
 |
 |
Date :
2012-06-09 23:49:06 |
By :
oakza |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ช่วยทีครับผมไม่รู้จะทำไงจริงๆ
|
 |
 |
 |
 |
Date :
2012-06-10 10:27:16 |
By :
oakza |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 05
|