Hi, im a complete noob at javascript and i need a function that calculates the value of a given number of words for the person to get a aproximate cost of the translation of text. This is for a simple website for my wife she translates some languages etc…
So what i want is that this code returns that cost, it gets the value from every textbox and gives the person the cost. (i will probably just use one textbox):
[CODE] var total = 0;
var idx = 0;
while(fieldObj = document.getElementById(‘num_’+ idx++))
{
total += parseInt(fieldObj.value) * ‘0.06’;
var thecost = “The cost will be about “;
var Euros = ” Euros”;
document.writeln(‘<br/>’ + thecost + total + Euros + ‘<br/>’);
return total;
}
The price per word is like 0.06 cents so for 1000 words it should reply 60, my problem is that the text does not get on the page, the document.writeln shows while you dont press the “return” messagebox that shows. and i dont want no messagebox, i just want the page to show a simple text saying “The cost will be about 60 Euros” and that’s it.
heeeeelp :p