|
|||||||
| JavaScript JavaScript (not Java) Discussion and technical support, including AJAX and frameworks (JQuery, MooTools, Prototype...) |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Ok the code goes like this:
// JavaScript Document function updatesum() { document.sumario.total.value = (document.sumario.precio[]1.value -0) + (document.sumario.precio[]2.value -0) + (document.sumario.precio[]3.value -0) + (document.sumario.precio[]4.value -0) + (document.sumario.precio[]5.value -0) + (document.sumario.precio[]6.value -0) + (document.sumario.precio[]7.value -0); I know that the problem here is the field name, but how do i make this work without having to change the names? I can't change them because i have many other functions with those names already. |
|
#2
|
||||
|
||||
|
Code:
document.sumario.elements['precio[]1'].value
__________________
At least 98% of internet users' DNA is identical to that of chimpanzees |
|
#3
|
|||
|
|||
|
still not working look at the live form, here it is.
http://www.foreverchef.com/test/forma.php and here's my sum code. http://www.foreverchef.com/test/autosum.js |
|
#4
|
||||
|
||||
|
updatesum does not have a closing bracket. Check the JavaScript Console.
__________________
At least 98% of internet users' DNA is identical to that of chimpanzees |
|
#5
|
|||
|
|||
|
I updated the code, but it still dosen't work, the field box dosent show the total.
I also tried using (getElementsByName) and it didn't work either. |
|
#6
|
||||
|
||||
|
I can not see that updatesum is called anywhere?
__________________
At least 98% of internet users' DNA is identical to that of chimpanzees |
|
#7
|
|||
|
|||
|
great
ok, great it works now! thanks.
It's now printing in total (A), but now i need to do a couple other things. I want to print the same result to field (11) And i want to make a second sum for fields (1) to (10) and print them on field (12) and them sum (11) + (12) and print it on field (13). |
![]() |
| Bookmarks |
| Tags |
| form data, forms, java script |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|