|
|
|
สอบถาม script คำนวนหน่อย ครับ คือว่า เปิดใน IE คำนวนปกติ แต่เปิดใน Chome คำนวน ผิดครับ |
|
|
|
|
|
|
|
ผิดอย่างไรต้องเอาผลกาคำนวนมาดูครับ
|
|
|
|
|
Date :
2013-09-02 14:52:17 |
By :
sakuraei |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
หน้าจอ แบบนี้ ครับ ทีแรกผมใช้ แค่ใน IE แต่ลองมาใช้ กับ Chome ผลลัพธ์ ไม่ตรงครับ
|
|
|
|
|
Date :
2013-09-02 15:07:15 |
By :
rock_rock |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ลองเอาบรรทัดนี้ออกดูน่ะครับ
Gtotal.val(Gtotal.addCommas());
|
|
|
|
|
Date :
2013-09-02 15:11:29 |
By :
sakuraei |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
จาก
Gtotal.val((parseFloat(total)+( (parseFloat(total)/parseFloat(100)*parseFloat(7))) ));
เป็น
Gtotal.val( (parseFloat(total)+ (parseFloat(total)*0.07) ) );
|
|
|
|
|
Date :
2013-09-02 15:17:20 |
By :
sakuraei |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ยังเหมือนเดิมครับ ผมลอง ให้คูณแถวเดียวก็เหมือนกัน ครับ
|
|
|
|
|
Date :
2013-09-02 15:33:13 |
By :
rock_rock |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
view page source มาดูกันหน่อยครับ
|
|
|
|
|
Date :
2013-09-02 15:47:05 |
By :
sakuraei |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ดูแล้วโค้ดมันเพี้ยนไปหมดจับต้นชนปลายไม่ถูกมันมั่วไปหมด
ลองเอาโค้ด html นี้ไปรันดูน่ะครับ
Code (PHP)
<body>
<table width="600" height="248" border="0" align="center" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#FFFFFF">
<tr>
<td height="58" colspan="5" align="center" valign="top"><img src="immage/com.jpg" width="620" height="56" /></td>
</tr>
<tr>
<td height="24" colspan="2" align="left" valign="top"></td>
<td colspan="3" align="left" valign="top" class="style133" ></td>
</tr>
<tr>
<td height="1" colspan="2" align="left" valign="middle"> </td>
<td colspan="3" align="left" valign="top"><br />
<br />
<br /></td>
</tr>
<tr>
<td width="252" height="7" align="center" valign="middle" > </td>
<td width="135" align="center" valign="middle" class="style133" ></td>
<td width="82" height="7" align="right" valign="middle"> </td>
<td width="22" height="7" align="center" valign="bottom"> </td>
<td width="122" align="left" valign="bottom"> </td>
</tr>
<tr>
<td colspan="5" align="center" valign="middle">
<script type="text/javascript">
function calcfunc(i) {
var val1 = parseFloat(document.getElementById("id1" + i).value);
var val2 = parseFloat(document.getElementById("id2" + i).value);
var result = val1*val2;
if (isFinite(result)) {
document.getElementById("id3" + i).value = result;
}
}
// Unidentifier from Thaicreate.com
$.fn.addCommas = function () {
return this.val().toString().replace(/\B(?=(?:\d{3})+(?!\d))/g, ",");
};
$(document).ready(function(){
var tbody = $("#summaryTable tbody tr");
var Gtotal = $("input:text#grandTotal");
var Gtotal2 = $("input:text#grandTotal2");
$("input:text",tbody).keyup(function(){
var total=0;
$("td:last-child > input:text",tbody).each(function(){
if($(this).val() != '')
total = parseFloat(total) + parseFloat($(this).val());
});
Gtotal.val( (parseFloat(total)+ (parseFloat(total)*0.07) ) );
});
});
</script>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script>
$(function(){
$("#process").click(function(){
var stock_order_member_rest = $("input[name*=stock_order_member_rest]")
var stock_order_member_send = $("input[name*=stock_order_member_send]")
var aar = [];
var aat = [];
var ssi = $("input[name*=stock_order_member_rest]").size()
stock_order_member_rest.each(function(value, key){
aar.push($(key).val())
})
stock_order_member_send.each(function(value, key){
aat.push($(key).val())
})
for(i=0;i<ssi;i++)
{
$("#stock_order_member_rest"+i).val(aar[i] - aat[i])
}
})
})
</script>
<form action='invoice_bin_in.php' method='post' name = "form" >
<table width="621" height="1%" border="0" align="center" cellspacing="0" bordercolor="#CCCCCC">
<tr>
<td width="50" align="left" valign="middle" bgcolor="#FFFFFF" >ชื่อบริษัท<br /></td>
<td width="365" align="left" valign="top" bgcolor="#FFFFFF" ><input name="stock_name" type="text" id="stock_name" size="30" /></td>
<td width="200" rowspan="2" align="left" valign="top" bgcolor="#FFFFFF" ><table width="200" border="0" align="left" cellspacing="0">
<tr>
<td width="94" align="right" valign="baseline">เลขที่</td>
<td width="13"> </td>
<td width="87" align="left" valign="baseline">
<input name="gencode" type="hidden" id="gencode" style="border:1px #0000FF solid; " value="NEW" disabled="disabled"/>
1-201309-0003
</td>
</tr>
<tr>
<td align="right" valign="baseline">วันที่</td>
<td> </td>
<td align="left" valign="baseline">2013-09-02
<input name="stock_date" type="hidden" id="stock_date" value="2013-09-02" size="30" /></td>
</tr>
</table></td>
</tr>
<tr>
<td align="left" valign="top" bgcolor="#FFFFFF" >
</td>
<td align="left" valign="top" bgcolor="#FFFFFF" > </td>
</tr>
</table>
<table width="621" border="1" align="center" cellspacing="0" bordercolor="#CCCCCC" id="summaryTable">
<tr class="gf">
<td width="17" align="center" valign="middle" bgcolor="#CCCCCC"> </td>
<td width="107" align="center" valign="middle" bgcolor="#CCCCCC">สินค้า</td>
<td width="107" align="center" valign="middle" bgcolor="#CCCCCC">ขนาด</td>
<td width="73" align="center" valign="middle" bgcolor="#CCCCCC">จำนวน</td>
<td width="72" align="center" valign="middle" bgcolor="#CCCCCC">จำนวนเหลือ</td>
<td width="72" align="center" valign="middle" bgcolor="#CCCCCC">จำนวนส่ง</td>
<td width="72" align="center" valign="middle" bgcolor="#CCCCCC">ราคา</td>
<td width="67" align="center" valign="middle" bgcolor="#CCCCCC">รวม</td>
</tr>
<tbody>
<tr>
<td align="center" valign="middle">
1</td>
<td align="left" valign="middle"><input name="stock_order_ID[]" type="hidden" id="stock_order_ID" value=" 1544" size="30" />
<input name="stock_order_generation[]" type="hidden" id="stock_order_generation" value=" 4-CSD-F(WD)" size="30" />
<input name="stock_idcode_pb[]" type="hidden" id="stock_idcode_pb" value="KF-201211-1547" size="30" />
4-CSD-F(WD) </td>
<td align="center" valign="middle"><strong>
<input name="stock_order_size[]" type="hidden" id="stock_order_size" value="10" X 10"" size="30" />
</strong>
10" X 10"</td>
<td align="center" valign="middle">3<input name="stock_order_member[]" type="hidden" id="stock_order_member" value="3" size="5" /></td>
<td align="center" valign="middle">
3<input name="stock_order_member_rest[]" type="hidden" id="stock_order_member_rest0" value="3" size="8" >
</td>
<td align="center" valign="middle">
<input name="stock_order_member_send[]" type="text" id="id10" onKeyUp="calcfunc(0)" value="" size="8" >
</td>
<td align="center" valign="middle">
<input type="text" id="id20" name="stock_price[]" size="8" onKeyUp="calcfunc(0)" >
</td>
<td align="center" valign="middle">
<input type="text" id="id30" name="stock_price_sum[]" size="8" >
</td>
</tr>
<tr>
<td align="center" valign="middle">
2</td>
<td align="left" valign="middle"><input name="stock_order_ID[]" type="hidden" id="stock_order_ID" value=" 1547" size="30" />
<input name="stock_order_generation[]" type="hidden" id="stock_order_generation" value=" 2-LSD" size="30" />
<input name="stock_idcode_pb[]" type="hidden" id="stock_idcode_pb" value="KF-201211-1547" size="30" />
2-LSD </td>
<td align="center" valign="middle"><strong>
<input name="stock_order_size[]" type="hidden" id="stock_order_size" value="48"" size="30" />
</strong>
48"</td>
<td align="center" valign="middle">1<input name="stock_order_member[]" type="hidden" id="stock_order_member" value="1" size="5" /></td>
<td align="center" valign="middle">
1<input name="stock_order_member_rest[]" type="hidden" id="stock_order_member_rest1" value="1" size="8" >
</td>
<td align="center" valign="middle">
<input name="stock_order_member_send[]" type="text" id="id11" onKeyUp="calcfunc(1)" value="" size="8" >
</td>
<td align="center" valign="middle">
<input type="text" id="id21" name="stock_price[]" size="8" onKeyUp="calcfunc(1)" >
</td>
<td align="center" valign="middle">
<input type="text" id="id31" name="stock_price_sum[]" size="8" >
</td>
</tr>
</tbody>
</table>
<table width="621" border="0" align="center" cellspacing="0" bordercolor="#CCCCCC">
<tr>
<td width="242" align="right" valign="middle" bgcolor="#FFFFFF"> </td>
<td width="292" align="right" valign="middle" bgcolor="#FFFFFF">ราคารวม </td>
<td width="10" align="center" valign="middle" bgcolor="#FFFFFF"> </td>
<td width="69" align="center" valign="middle" bgcolor="#FFFFFF"><input name="sum_not_vat" type="text" id="grandTotal2" size ="8"/></td>
</tr>
<tr>
<td align="right" valign="middle" bgcolor="#FFFFFF"> </td>
<td align="right" valign="middle" bgcolor="#FFFFFF">ราคารวม vat 7</td>
<td align="center" valign="middle" bgcolor="#FFFFFF"> </td>
<td align="center" valign="middle" bgcolor="#FFFFFF"><input name="sum_vat" type="text" id="grandTotal" size ="8"/></td>
</tr>
</table>
<br />
<input type="submit" name="Submit" id="process" value=" PRINT " onclick="javascript:this.style.display='none';window.print()" />
</form>
</td>
</tr>
<tr>
<td height="1" colspan="5" align="left" valign="top">
</td>
</tr>
<tr>
<td height="36" colspan="5" align="center" valign="middle">
<p>
</p>
</p></td>
</tr>
</table>
</body>
|
|
|
|
|
Date :
2013-09-02 16:27:27 |
By :
sakuraei |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
คือคุณวางตำแหน่ง <tbody></tbody> มั่วครับ
แถมยังมี table id="summaryTable" ถึงสองตัว
อันที่จริงแล้วสำหรับ html พื้นฐาน 1 table ต้องมี tbody 1ชุดเท่านั้นแล้วภายในก็มี tr td ครับ
ไม่ใช่ tr tbody td
ลองไล่โค้ดดูดีๆ
|
|
|
|
|
Date :
2013-09-02 16:31:45 |
By :
sakuraei |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|