???? ?? ??? jQuery ??
? ????? jQuery ??? ???? ????? ??? ?? ??? ??? ?????.
?? ??, ?? ??, ??? ???? ?? ?? ??? ???? ????.
?? ???? ???? <input id="Checkbox1" type="checkbox" class="allselect"/> ???? ????
?? ??? ???? ??< ;?????. type="checkbox">? ???????. ????? ????? ?? ?? ??? ???? ???, ???? ?? ?? ??? ?? ????? ?????. ?? ??? ?????. ?? ??? ?? ? ??? ???? ??? ??, ??? ???? ??? ?????.
<script type="text/javascript"> $(document).ready(function () { //jquery特效制作復(fù)選框全選反選取消(無(wú)插件) // 全選 $(".allselect").click(function () { if(this.checked){ $(".gwc_tb2 input[name=newslist]").prop("checked",true); } else{ $(".gwc_tb2 input[name=newslist]").prop("checked",false); $(this).next().css({ "background-color": "#3366cc", "color": "#ffffff" }); } GetCount(); }); //反選 $("#invert").click(function () { $(".gwc_tb2 input[name=newslist]").each(function () { if ($(this).prop("checked")) { $(this).prop("checked", false); $(this).next().css({ "background-color": "#ffffff", "color": "#000000" }); } else { $(this).prop("checked", true); $(this).next().css({ "background-color": "#3366cc", "color": "#000000" }); } }); GetCount(); }); //取消 $("#cancel").click(function () { $(".gwc_tb2 input[name=newslist]").each(function () { $(this).prop("checked", false); $(this).next().css({ "background-color": "#ffffff", "color": "#000000" }); }); GetCount(); }); // 所有復(fù)選(:checkbox)框點(diǎn)擊事件 $(".gwc_tb2 input[name=newslist]").click(function () { if ($(this).prop("checked")) { $(this).next().css({ "background-color": "#3366cc", "color": "#ffffff" }); } else { $(this).next().css({ "background-color": "#ffffff", "color": "#000000" }); } }); // 輸出 $(".gwc_tb2 input[name=newslist]").click(function () { GetCount(); }); }); //獲取數(shù)量 function GetCount() { var conts = 0; var aa = 0; $(".gwc_tb2 input[name=newslist]").each(function () { if ($(this).prop("checked")) { for (var i = 0; i < $(this).length; i++) { conts += parseInt($(this).val()); aa += 1; } } }); $("#shuliang").text(aa); $("#zong1").html((conts).toFixed(2)); //toFixed() 方法可把 Number 四舍五入為指定小數(shù)位數(shù)的數(shù)字。 $("#jz1").css("display", "none"); $("#jz2").css("display", "block"); } </script>
?? ?? ?? ??? ??? ?? ??? ????
??? ?? ??? ???? ???? ?????.<input id="">? id? ?????? ?????. "+" ?? ?? ? ?? ??? +1? ??, "-" ?? ?? ? ?? ??? -1? ???. . ?? ?? ??? ?? ??? ? ??? ?????.
??? ???? ???? ? ??? ????. ?? ??? 0?? ????? ? "-" ??? ???? ?? ??? ????? ?? ??????.
??? ?? ??? 0? ? "-" ??? ????? ?? ??? ? ?? -1? ?? ?? ?? ?? ?? ???? ? ?? ???? ????.
<!---商品加減算總數(shù)----> <script type="text/javascript"> $(function () { var t = $("#text_box1"); $("#add1").click(function () { t.val(parseInt(t.val()) + 1); setTotal(); GetCount(); }); $("#min1").click(function () { if(parseInt(t.val() - 1) < 0){ return false; }else { t.val(parseInt(t.val()) - 1); } setTotal(); GetCount(); }); function setTotal() { $("#total1").html((parseInt(t.val()) * 9).toFixed(2)); $("#newslist-1").val(parseInt(t.val()) * 9); } setTotal(); }) </script>
?? ??? ???? ??? ??? ? ??? ? ??? ?????.<!---總數(shù)---->
<script type="text/javascript">
$(function () {
$(".quanxun").click(function () {
setTotal();
//alert($(lens[0]).text());
});
function setTotal() {
var len = $(".tot");
var num = 0;
for (var i = 0; i < len.length; i++) {
num = parseInt(num) + parseInt($(len[i]).text());
}
//alert(len.length);
$("#zong1").text(parseInt(num).toFixed(2));
$("#shuliang").text(len.length);
}
//setTotal();
})
</script>
??:
??? ??? ?? ?? ????? ??? ? ????