Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > สอบถามเรื่อง javascript autosum หน่อยครับติดไม่รู้จะแก้ยังไงครับ



 

สอบถามเรื่อง javascript autosum หน่อยครับติดไม่รู้จะแก้ยังไงครับ

 



Topic : 051041



โพสกระทู้ ( 2,249 )
บทความ ( 5 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook Hi5 Blogger



Code (JavaScript)
function startCalc(){
  interval = setInterval("calc()",1);
}
function calc(){
  txt1 = document.perform.selft1.value;
  txt2 = document.perform.head1.value; 
  txt3 = document.perform.totalbuddy1.value;
  txt4 = document.perform.totalemp1.value; 
  //------------------------------>1.2
  txt9 = document.perform.selft2.value;
  txt10 = document.perform.head2.value; 
  txt11 = document.perform.totalbuddy2.value;
  txt12 = document.perform.totalemp2.value; 
  //------------------------------>1.3
  txt17 = document.perform.selft3.value;
  txt18 = document.perform.head3.value; 
  txt19 = document.perform.totalbuddy3.value;
  txt20 = document.perform.totalemp3.value; 
  //-------------------------->1.4
  txt21 = document.perform.selft4.value;
  txt22 = document.perform.head4.value; 
  txt23 = document.perform.totalbuddy4.value;
  txt24 = document.perform.totalemp4.value; 
  //---------------------------->1.5
  txt25 = document.perform.selft5.value;
  txt26 = document.perform.head5.value; 
  txt27 = document.perform.totalbuddy5.value;
  txt28 = document.perform.totalemp5.value; 
  //----------------------minuit
  txt111 = document.perform.lvget1.value;
  txt222 = document.perform.lvget2.value; 
  txt333= document.perform.lvget3.value;
  txt444 = document.perform.lvget4.value;
  txt555 = document.perform.lvget5.value;
  txt666 = document.perform.totalcompet1.value;
  txt777 = document.perform.totalcompet2.value; 
  txt888= document.perform.totalcompet3.value;
  txt999 = document.perform.totalcompet4.value;
  txt110 = document.perform.totalcompet5.value;
  txts1 = document.perform.totallv1.value;
  txts2 = document.perform.totallv2.value; 
  txts3 = document.perform.totallv3.value;
  txts4 = document.perform.totallv4.value;
  txts5 = document.perform.totallv5.value;
  txth1 = document.perform.addhybrid1.value;
  txth2 = document.perform.addhybrid2.value; 
  txth3 = document.perform.addhybrid3.value;
  txth4 = document.perform.addhybrid4.value;
  txth5 = document.perform.addhybrid5.value;
  txtd1 = document.perform.resscore1.value;
  txtd2 = document.perform.resscore2.value; 
  txtd3 = document.perform.resscore3.value;
  txtd4 = document.perform.resscore4.value;
  txtd5 = document.perform.resscore5.value;


  document.perform.totalcompet1.value = ((txt1 * 1) + (txt2 * 1) + (txt3 * 1)+ (txt4 * 1));
  document.perform.totalcompet2.value = ((txt9 * 1) + (txt10 * 1) + (txt11 * 1)+ (txt12 * 1));
  document.perform.totalcompet3.value = ((txt17 * 1) + (txt18 * 1) + (txt19 * 1) + (txt20 * 1));
  document.perform.totalcompet4.value = ((txt21 * 1) + (txt22 * 1) + (txt23 * 1) + (txt24 * 1));
  document.perform.totalcompet5.value = ((txt25 * 1) + (txt26 * 1) + (txt27 * 1) + (txt28 * 1));
  document.perform.differ1.value = ((txtd1 * 1) - (txt111 * 1));
  document.perform.differ2.value = ((txtd2 * 1) - (txt222 * 1));
  document.perform.differ3.value = ((txtd3 * 1) - (txt333 * 1));
  document.perform.differ4.value = ((txtd4 * 1) - (txt444 * 1));
  document.perform.differ5.value = ((txtd5 * 1) - (txt555 * 1));
  document.perform.totallv1.value = (((txt666 * 1)/100)*(5));
  document.perform.totallv2.value = (((txt777 * 1)/100)*(5));
  document.perform.totallv3.value = (((txt888 * 1)/100)*(5));
  document.perform.totallv4.value = (((txt999 * 1)/100)*(5));
  document.perform.totallv5.value = (((txt110 * 1)/100)*(5));
  document.perform.resscore1.value = ((txts1 * 1)+(txth1 * 1));
  document.perform.resscore2.value = ((txts2 * 1)+(txth2 * 1));
  document.perform.resscore3.value = ((txts3 * 1)+(txth3 * 1));
  document.perform.resscore4.value = ((txts4 * 1)+(txth4 * 1));
  document.perform.resscore5.value = ((txts5 * 1)+(txth5 * 1));
}
function stopCalc(){
  clearInterval(interval);
}



ปัญหาคือผมจะทำการรวมค่าคะแนนในฟอร์มอัติโนมัติครับ คือเงื่อนไขมันมีอยู่ว่ามีคะแนนอยู่ 4 อัน คือ a,b,c,d ซึ่งมีจำนวนเต็มอันละ 20 คะแนน รวมกันจะได้ 100 เต็ม แต่กรณีที่ บางคนจะไม่มีคะแนนจาก d ให้เอาคะแนน a,b,c รวมกันแล้วทำเป็น 100% แทน ผมจะต้องไปใส่เงื่อนไขตรงไหนครับ



Tag : PHP, JavaScript







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2010-11-01 22:02:57 By : Manussawin View : 1213 Reply : 4
 

 

No. 1



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

อยากจะช่วยน่ะครับ แต่ตัวแปรเยอะเหลือเกิน






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2010-11-02 06:15:54 By : webmaster
 


 

No. 2



โพสกระทู้ ( 2,249 )
บทความ ( 5 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook Hi5 Blogger

Code (JavaScript)
function startCalc(){
  interval = setInterval("calc()",1);
}
function calc(){
  txt1 = document.perform.selft1.value;
  txt2 = document.perform.head1.value; 
  txt3 = document.perform.totalbuddy1.value;
  txt4 = document.perform.totalemp1.value; 
  //------------------------------>1.2
  txt9 = document.perform.selft2.value;
  txt10 = document.perform.head2.value; 
  txt11 = document.perform.totalbuddy2.value;
  txt12 = document.perform.totalemp2.value; 
  //------------------------------>1.3
  txt17 = document.perform.selft3.value;
  txt18 = document.perform.head3.value; 
  txt19 = document.perform.totalbuddy3.value;
  txt20 = document.perform.totalemp3.value; 
  //-------------------------->1.4
  txt21 = document.perform.selft4.value;
  txt22 = document.perform.head4.value; 
  txt23 = document.perform.totalbuddy4.value;
  txt24 = document.perform.totalemp4.value; 
  //---------------------------->1.5
  txt25 = document.perform.selft5.value;
  txt26 = document.perform.head5.value; 
  txt27 = document.perform.totalbuddy5.value;
  txt28 = document.perform.totalemp5.value; 

  document.perform.totalcompet1.value = ((txt1 * 1) + (txt2 * 1) + (txt3 * 1)+ (txt4 * 1));
  document.perform.totalcompet2.value = ((txt9 * 1) + (txt10 * 1) + (txt11 * 1)+ (txt12 * 1));
  document.perform.totalcompet3.value = ((txt17 * 1) + (txt18 * 1) + (txt19 * 1) + (txt20 * 1));
  document.perform.totalcompet4.value = ((txt21 * 1) + (txt22 * 1) + (txt23 * 1) + (txt24 * 1));
  document.perform.totalcompet5.value = ((txt25 * 1) + (txt26 * 1) + (txt27 * 1) + (txt28 * 1));




นี่ครับพี่วิน ที่ติดจริงๆ คืออันนี้มันคำนวณตรงๆ แต่พอดีมันดันมีเงื่อนไขเพิ่มมาอีกครับ ว่า มีคะแนน a,b,c,d รวมแล้วมัน 100 คะแนน แต่ถ้า มีแค่ 3 คือ a,b,c ให้คิดเป็น 100% เลย ไม่รู้จะเพิ่มตรงไหน ช่วยชี้แนะด้วยครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2010-11-02 12:37:26 By : Manussawin
 

 

No. 3



โพสกระทู้ ( 11,835 )
บทความ ( 10 )

สมาชิกที่ใส่เสื้อไทยครีเอท Hall of Fame 2012

สถานะออฟไลน์


in percent
--------- X ---------
(a+b+c) 100

ตามสูตร

คือแบบว่าไอ้ a b c ที่ว่ามันคือตรงไหนอะ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2010-11-02 13:53:24 By : PlaKriM
 


 

No. 4



โพสกระทู้ ( 2,249 )
บทความ ( 5 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook Hi5 Blogger

ครับพี่ปรากริม โทษทีครับที่ทำให้งง อิอิเอาใหม่

A คือ ตัวแปร txt1,txt2,txt3,txt4
B คือ 1.2
C คือ 1.3
D คือ 1.4
E คือ 1.5

คือในแต่ละชุดมีค่าคะแนน 20 รวมกันได้ 100 คะแนน (100%) แบบที่1
แบบที่ 2 คือจะไม่มี E มาเกี่ยวข้องครับ ก็จะมีคะแนนจริงๆ 80 คะแนน (ทำให้เป็น 100% แทนแบบที่1)
คือไม่รู้จะกำหนดเงื่อนไขตรงไหนครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2010-11-03 03:31:56 By : Manussawin
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : สอบถามเรื่อง javascript autosum หน่อยครับติดไม่รู้จะแก้ยังไงครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 03
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่