473,394 Members | 1,715 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,394 software developers and data experts.

learning javascript ... yet another issue, what's wrong with this function please ?

67
Hi guys

I am new to javascript, and just started to taste the beauty of this language. Till now I was afraid touching this subject with the vision that since many people can't see javascript, there's no point learning this. It seems that my state of mind is changing now, as now I don't see any reason why I shouldn't make something for 98% of the population just because 2% can't get it.

So here I am. A couple of days ago gits helped me to sort out a lengthy (?) 30 line javascript code. Here, I was trying to make something different, but is in a mess. Don't know what's going wrong, as firefox is now showing any error.

Expand|Select|Wrap|Line Numbers
  1. // my form
  2. <input type="text" size="4" maxlength="4" name="echantillon" id="echantillon" value="" />&nbsp;<input type="button" class="button" value="Je valide" onclick="recalculateAchat('echantillon');" />
  3.  
Expand|Select|Wrap|Line Numbers
  1. // my function
  2. function recalculateAchat(id) {
  3.     var achatArray = new Array();
  4.     achatArray['REC1'] = 5;
  5.     achatArray['REC2'] = 10;
  6.     box = document.getElementById(id);
  7.     var discount = box.value;
  8.     for(remise in achatArray){
  9.         if (remise == discount) {
  10.             var value = achatArray[remise];
  11.             getAjax('achat.php','achat','exact',value,'','','');
  12.             break;
  13.         }
  14.     }
  15. }
  16.  
and then
[php]
$carteTotal = ($exact!='') ? $carteTotal - $exact : $carteTotal;
[/php]

For some reason nothing is happening as I click on the button. Normally, it should reload a div with new $careTotal value.

Any foresight ? Can anyone help me with some tips ... :)
Thanks.
Nov 23 '07 #1
1 1187
acoder
16,027 Expert Mod 8TB
Can I see your getAjax function?
Nov 23 '07 #2

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

Similar topics

53
by: Cardman | last post by:
Greetings, I am trying to solve a problem that has been inflicting my self created Order Forms for a long time, where the problem is that as I cannot reproduce this error myself, then it is...
136
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
27
by: Chris | last post by:
Hi, I have a form for uploading documents and inserting the data into a mysql db. I would like to validate the form. I have tried a couple of Javascript form validation functions, but it...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.