질문좀 드리겠습니다
아래보시는 소스는 체크박스로 클릭시 자동으로 더해지는 소스인데요
그런데 맨아래 합계 되는 부분이 이부분인데요
total_sum1 에서는 자동으로 곱하기 x6이 되길 원하구요
total_sum2 에서는 자동으로 곱하기 x12이 되길 원하는데 방법좀 알려주시면 감사하겠습니다 ..ㅠㅠ
<td><input name="total_sum1" type="text" size="20" readonly></td>
<td><input name="total_sum2" type="text" size="20" readonly></td>
Copy
<script language="javascript"><!--function itemSum(frm){ var sum = 0; var count = frm.chkbox.length; for(var i=0; i < count; i++ ){ if( frm.chkbox[i].checked == true ){ sum += parseInt(frm.chkbox[i].value); } } frm.total_sum.value = sum; frm.total_sum1.value = sum; frm.total_sum2.value = sum; }//--> </script> <style>.mina_fr {font-size:12px;} .mina_fr tr {border-bottom:1px solid #e5e8ec; height: 40px;}.mina_fr th {width:20%; padding-left: 15px;font-size:13px;font-weight: bold; }.mina_fr td {width:70%;}.mina_fr table {width:100%;border:1px solid #e5e8ec;} .main_ta {width:100%;margin-top:30px;margin-bottom:30px;}.main_ta table {width:100%; border:1px solid #e5e8ec;}.main_ta tr {height: 40px;}.main_ta th {border-right: 1px solid #e5e8ec;padding-left: 0px;width:25%;border-bottom:1px solid #e5e8ec;text-align: center;} .main_ta td {text-align: center;width:25%;border-bottom:1px solid #e5e8ec;} </style> <div class="mina_fr"> <form name="form"> <table> <tr> <th>룸오피스</th> <td> <input name="chkbox" type="checkbox" value="600000" onClick="itemSum(this.form);"> 1인실 <input name="chkbox" type="checkbox" value="800000" onClick="itemSum(this.form);"> 2인실 <input name="chkbox" type="checkbox" value="900000" onClick="itemSum(this.form);"> 2~3인실 <input name="chkbox" type="checkbox" value="1100000" onClick="itemSum(this.form);"> 3인실 <input name="chkbox" type="checkbox" value="1300000" onClick="itemSum(this.form);"> 4인실 <input name="chkbox" type="checkbox" value="1500000" onClick="itemSum(this.form);"> 5인실 </td> </tr> <tr> <th>스마트오피스</th> <td> <input name="chkbox" type="checkbox" value="350000" onClick="itemSum(this.form);"> 1인실 <input name="chkbox" type="checkbox" value="350000" onClick="itemSum(this.form);"> 2인실 <input name="chkbox" type="checkbox" value="350000" onClick="itemSum(this.form);"> 3인실 <input name="chkbox" type="checkbox" value="350000" onClick="itemSum(this.form);"> 4인실 <input name="chkbox" type="checkbox" value="350000" onClick="itemSum(this.form);"> 5인실 <input name="chkbox" type="checkbox" value="350000" onClick="itemSum(this.form);"> 6인실 </td> </tr> <tr> <th>비상주오피스</th> <td> <input name="chkbox" type="checkbox" value="100000" onClick="itemSum(this.form);"> 개인 <input name="chkbox" type="checkbox" value="150000" onClick="itemSum(this.form);"> 법인 </td> </tr> </table> <div class="main_ta"> <table> <tr> <th>우편물 알림</th> <th>우편물 발송</th> <th>서류보관</th> <th>사물함</th> </tr> <tr> <td colspan="4">오피스 이용고객 기본제공</td> </tr> </table></div> <table> <h4>법무서비스</h4> <tr> <th>법인설립</th> <td> <input name="chkbox" type="checkbox" value="330000" onClick="itemSum(this.form);"> 법인설립 </td> </tr> <tr> <th>표준정관변경</th> <td> <input name="chkbox" type="checkbox" value="550000" onClick="itemSum(this.form);"> 표준정관변경 </td> </tr> <tr> <th>업장이전 변경등기</th> <td> <input name="chkbox" type="checkbox" value="330000" onClick="itemSum(this.form);"> 업장이전 변경등기 </td> </tr> </table> <table> <h4>세무서비스</h4> <tr> <th>사업자등록</th> <td> <input name="chkbox" type="checkbox" value="200000" onClick="itemSum(this.form);"> 사업자등록 </td> </tr> <tr> <th>기장대리 (개인)</th> <td> <input name="chkbox" type="checkbox" value="100000" onClick="itemSum(this.form);"> (개인)부가세신고,4대보험신고 </td> </tr> <tr> <th>기장대리 (법인)</th> <td> <input name="chkbox" type="checkbox" value="150000" onClick="itemSum(this.form);"> (법인)원천세신고,지급조서신고,연말정산신고 </td> </tr> </table> <table> <h4>경영지도서비스 (단일서비스)</h4> <tr> <th>고용지원금 - 1</th> <td> <input name="chkbox" type="checkbox" value="1000000" onClick="itemSum(this.form);"> 고용지원금 - 1 / 착수금:1,000,000 / 성공보수:10% </td> </tr> <tr> <th>고용지원금 - 2</th> <td> <input name="chkbox" type="checkbox" value="500000" onClick="itemSum(this.form);"> 고용지원금 - 2 / 착수금:500,000 / 성공보수:15% </td> </tr> <tr> <th>정책자금(유상)</th> <td> <input name="chkbox" type="checkbox" value="1000000" onClick="itemSum(this.form);"> 정책자금(유상) / 착수금:1,000,000 / 성공보수:3% </td> </tr> <tr> <th>정책자금(무상)</th> <td> <input name="chkbox" type="checkbox" value="1000000" onClick="itemSum(this.form);"> 정책자금(무상) / 착수금:1,000,000 / 성공보수:10% </td> </tr> <tr> <th>벤처기업 확인 - 1</th> <td> <input name="chkbox" type="checkbox" value="500000" onClick="itemSum(this.form);"> 벤처기업 확인 - 1 / 착수금:500,000 / 성공보수:1,000,000 </td> </tr> <tr> <th>벤처기업 확인 - 2</th> <td> <input name="chkbox" type="checkbox" value="1000000" onClick="itemSum(this.form);"> 벤처기업 확인 - 2 / 착수금:1,000,000 / 성공보수:3% </td> </tr> <tr> <th>기업부설연구소 설립</th> <td> <input name="chkbox" type="checkbox" value="1000000" onClick="itemSum(this.form);"> 기업부설연구소 설립 / 착수금:500,000 / 성공보수:500,000 </td> </tr> </table> <table> <h4>경영지도서비스 (복합서비스)</h4> <tr> <th>고용지원금<br> 벤처기업 확인 - 2<br> 기업부설연구소 설립</th> <td colspan="3"> <input name="chkbox" type="checkbox" value="200000" onClick="itemSum(this.form);"> 착수금:2,000,000 / 고용지원금 성공보수:10% / 벤처기업 확인 - 2 성공보수:3% </td> </tr> <tr> <th>벤처기업 확인 - 2<br> 기업부설연구소 설립</th> <td> <input name="chkbox" type="checkbox" value="1500000" onClick="itemSum(this.form);"> 착수금:1,500,000 / 벤처기업 확인 - 2 성공보수:3% </td> </tr> </table> </table> <div class="main_ta"> <table> <tr> <th>3개월</th> <th>6개월</th> <th>12개월</th> </tr> <tr> <td><input name="total_sum" type="text" size="20" readonly></td> <td><input name="total_sum1" type="text" size="20" readonly></td> <td><input name="total_sum2" type="text" size="20" readonly></td> </tr> </table></div> </form> </div></div></div>
|
답변 1개
채택된 답변
+20 포인트
2017-06-08 (목) 16:22:41
frm.total_sum1.value = sum * 6;
frm.total_sum2.value = sum * 12;
이렇게 하면 안되나요?
답변을 작성하려면 로그인이 필요합니다.