我试图在我的计算机上添加一个£符号,我似乎无法做到

时间:2015-06-30 15:41:20

标签: javascript currency

function fillconcert() {
    concert.options.length = 0;
    var e = document.getElementById("concert");
    var artist = document.getElementById("artist").selectedIndex

    switch (artist) {
        case 1:
            var arr = new Array("210.00");
            fillList(arr, e);
            break;

            case 2:
                var arr = new Array("260.00");
                fillList(arr, e);
                break;

            case 3:
                var arr = new Array("275.00");
                fillList(arr, e);
                break;

            case 4:
                 var arr = new Array("290.00");
                 fillList(arr, e);
                 break;         

            case 5:
                 var arr = new Array("210.00");
                 fillList(arr, e);
                 break;

            case 6:
                var arr = new Array("255.00");
                fillList(arr, e);
                break;
    }
}



function total(number1,number2){
    var amount = document.getElementById("concert").value
    var adding = document.getElementById("cost").value
    var addingTwo = document.getElementById("people").value
    var intOutput = (adding)*(addingTwo)*parseFloat(amount);

    document.getElementById("output").innerHTML=intOutput;
}

这是一个动态下拉菜单,所以当他们选择一个选项时会给他们一个价格,但是当他们输入所有内容时它会显示为数字。反正在这周围?

1 个答案:

答案 0 :(得分:0)

您应该在HTML的开头添加它:

document.getElementById("output").innerHTML = "£" + intOutput;