回覆列表
  • 1 # 云云科技社

    //1.如果checkbox name一樣var boxValue = "";var box = document.getElementsByName("checkBoxName");//checkbox的namefor(var i = 0 ; i < box.length ; i ++){if(box[i].checked){boxValue += """+box[i].value+"",";}}if(boxValue.length>1){boxValue = boxValue.substring(0,boxValue.length-1);}//2.透過input獲取,但是頁面沒有其他型別的checkboxvar inputRef = document.getElementsByTagName("input");var len = inputRef.length;var arsInput = "";var boxValue = "";for(var i = 0; i < len; i++){arsInput = inputRef[i];if(arsInput.type=="checkbox" ){if(arsInput.checked){boxValue += """+arsInput[i].value+"",";}}}if(boxValue.length>1){boxValue = boxValue.substring(0,boxValue.length-1);}

  • 中秋節和大豐收的關聯?
  • 當你的淚水劃過側臉,這是什麼歌的歌詞?