solved it by myself.

endpreis =Math.round(endpreis*100)/100;
endpreis = endpreis+" foo";
endpreis = endpreis.replace(/ foo/,"");
var cent = endpreis.split(".");

if(cent[1].length == 1)
{
        endpreis = endpreis+"0";
}else{
        if(cent[1].length == 2)
        {
                //schoen so
        }else{
                endpreis = endpreis+".00";
        }
}

On 7 Jul., 12:11, weidc <mueller.juli...@googlemail.com> wrote:
> hi,
>
> thats my code:
>
> endpreis =Math.round(endpreis*100)/100;
>
> to round the price of something but i'd like to have 2,00 or 2,50
> instead of 2 and 2,5.
>
> i'd be happy about any help.
>
> --weidc

Reply via email to