簡體   English   中英

未選中復選框時的彈出窗口

[英]Popup window when checkbox has not been checked

這是jQuery還是JavaScript? 我的作業不允許使用jQuery。

function calculateTotal() {
    var collection = document.getElementsByName('deliveryType'),
        cds = document.getElementsByName('cd[]'),
        cdTotal = 0,
        L = collection.length;

    while(L--) {
        if(collection[L].checked) {   // get shipping costs
            collection = Number(collection[L].getAttribute('title')); 
            break;
        }
    }

    L = cds.length;
    while(L--) {
        if(cds[L].checked) {    //add total prices
            cdTotal += Number(cds[L].getAttribute('title'));
        }
    }

    //  output total
    document.getElementById('total').value = collection + cdTotal;
}

只是JavaScript。 如果您使用的是JQuery,則會看到一個美元符號“ $”或“ JQuery”關鍵字。 閱讀有關API文檔的更多信息: http : //api.jquery.com/jQuery/

這是純JavaScript代碼-如果您不確定只是在某個地方查找jQuery。 通常看起來像這樣:

<script type="text/javascript" src="jquery.js"></script>

您還可以通過在瀏覽器中按F12來檢查加載了哪些資源。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM