473,396 Members | 1,995 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Sum the values of multiple input text fields - does not work

Hello,

I'm sorry, my English is bad

Sample: Max limit: 10

Sample:
Expand|Select|Wrap|Line Numbers
  1. <form method="POST" onsubmit="return kontrol()">
  2. <input type="text" name="secilen_receiver_sayisi[]">
  3. <input type="text" name="secilen_receiver_sayisi[]"> 2
  4. <input type="text" name="secilen_receiver_sayisi[]"> 4
  5. <input type="text" name="secilen_receiver_sayisi[]"> 3
  6. <input type="text" name="secilen_receiver_sayisi[]">
  7. <input type="text" name="secilen_receiver_sayisi[]"> 3
  8. <input type="submit" value="Submit">
Expand|Select|Wrap|Line Numbers
  1. alert("Total max allowed: 10");

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. function kontrol()
  3. {
  4.     amount=document.getElementsByName("secilen_receiver_sayisi[]");
  5.     total = 0;
  6.     for(x=0;x<amount.length;x++)
  7.     {
  8.         total += parseInt(amount[x].value);
  9.  
  10.     }
  11.         if(total>10){
  12.         alert("The total amount passed 10");
  13.         return false;
  14.         }    
  15.     return true;
  16. }
  17. </script>
  18.  
This code does not work

Could you help?


Thanks
Dec 11 '12 #1
3 3479
Dormilich
8,658 Expert Mod 8TB
in which regard does it not work?
Dec 11 '12 #2
Hello,
Total and alert("");
I think I got the error codes

Thank you
Dec 12 '12 #3
Expand|Select|Wrap|Line Numbers
  1. function kontrol(){
  2.     var arr = document.getElementsByName('secilen_receiver_sayisi[]');
  3.     var tot=0;
  4.     for(var i=0;i<arr.length;i++){
  5.         if(parseInt(arr[i].value))
  6.             tot += parseInt(arr[i].value);
  7.     }
  8.     if(tot>10){
  9.     alert("aaaaaaaa");
  10.     return false;
  11.     }
  12. }
  13.  
Problem OK

Thanks
Dec 14 '12 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: x. zhang | last post by:
Hi Guys, We know that we can use <input type=file ...> to upload one file per time to the server. My question is if there are some way to upload multiple files per time to the server. (Of...
2
by: Paul A. Steckler | last post by:
I need to write a TCP/IP server in C# that can handle multiple connections. My first try was to use TCPListener instances in multiple .NET threads. Of course, I got an exception from...
30
by: Vla | last post by:
why did the designers of c++ think it would be more useful than it turned out to be?
4
by: liu | last post by:
how c language to realize multiple ? can anyone tell me , thank you!
22
by: Matthew Louden | last post by:
I want to know why C# doesnt support multiple inheritance? But why we can inherit multiple interfaces instead? I know this is the rule, but I dont understand why. Can anyone give me some concrete...
3
by: Arun | last post by:
Hi, I have simple question to ask. How to write multiple Binary files to the Browser using Asp.Net and Visual C#.net I have seen examples where single binary file is written to browser. ...
5
by: Neelesh Bodas | last post by:
This might be slightly off-topic. Many books on C++ consider multiple inheritence as an "advanced" concept. Bruce Eckel says in TICPP, volume 2 that "there was (and still is) a lot of...
3
by: spolsky | last post by:
hi, it is possible to apply multiple styles as shown in the following example. <STYLE TYPE="text/css"><!-- BODY { background-color:salmon; } P { margin-left:20px; } .clsCode {...
6
by: Joseph Geretz | last post by:
I have the following class which I am serializing and passing back and forth between my Web Service application and the client. public class Token : SoapHeader { public string SID; public...
35
by: keerthyragavendran | last post by:
hi i'm downloading a single file using multiple threads... how can i specify a particular range of bytes alone from a single large file... for example say if i need only bytes ranging from...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.