Hi,
I'm a novice at this. I've managed to learn by example and come up with this Javascript code from various examples on the web.
Could someone please help me with providing code that will display the $ sign at the beginning of the number and seperate the number at thousands by a ',' in the text field (price).
I have no idea how to do this. Many thanks
[CODE=javascript]
function aircraftcost()
{
var
buy_cost = document.getEle mentById('buypr ice').value,
sale_price = 500 * 30 * buy_cost; //is it correct to have a ; after buy_cost?
document.getEle mentById('price ').value = (sale_price).to Fixed(2);
//how do I add a '$' sign for this 'price' value and insert a ',' at the thousands mark?
}
[/CODE]
I'm a novice at this. I've managed to learn by example and come up with this Javascript code from various examples on the web.
Could someone please help me with providing code that will display the $ sign at the beginning of the number and seperate the number at thousands by a ',' in the text field (price).
I have no idea how to do this. Many thanks
[CODE=javascript]
function aircraftcost()
{
var
buy_cost = document.getEle mentById('buypr ice').value,
sale_price = 500 * 30 * buy_cost; //is it correct to have a ; after buy_cost?
document.getEle mentById('price ').value = (sale_price).to Fixed(2);
//how do I add a '$' sign for this 'price' value and insert a ',' at the thousands mark?
}
[/CODE]
Comment