자바스크립트관련 자동계산

자바스크립트관련 자동계산

QA

자바스크립트관련 자동계산

본문

부족하게 나마 자동계산이 되게 만들어 보려고 합니다.

여분필드에 explode를 사용하여 아래와 같이 여러필드로 나누어서 사용했습니다.



아래와 같이 자바스크립트를 짠후에 제품 개수를 적으면 각 제품의 무게가 자동으로 계산되게 하고 싶어서 아래와 같이 스크립트를 구성했습니다.

화면상에는 자동계산되어 진것이 보여지는데 그 상태로 올리면 각 제품의 개수는 나눈 필드에 저장이 되는데 계산된 결과는 저장이 되질 않습니다.

///////////////////////필드 나눈부분///////////////////////////
$ex11_filed = explode("|",$write[wr_11]);
$ext11_00  = $ex11_filed[0];
$ext11_01  = $ex11_filed[1];
$ext11_02  = $ex11_filed[2];
$ext11_03  = $ex11_filed[3];
$ext11_04  = $ex11_filed[4];
$ext11_05  = $ex11_filed[5];
$ext11_06  = $ex11_filed[6];
$ext11_07  = $ex11_filed[7];
$ext11_08  = $ex11_filed[8];
$ext11_09  = $ex11_filed[9];
$ext11_10  = $ex11_filed[10];
$ext11_11  = $ex11_filed[11];
$ext11_12  = $ex11_filed[12];
$ext11_13  = $ex11_filed[13];
$ext11_14  = $ex11_filed[14];
$ext11_15  = $ex11_filed[15];
$ext11_16  = $ex11_filed[16];
$ext11_17  = $ex11_filed[17];
$ext11_18  = $ex11_filed[18];
$ext11_19  = $ex11_filed[19];
$ext11_20  = $ex11_filed[20];
$ext11_21  = $ex11_filed[21];
$ext11_22  = $ex11_filed[22];

$ex12_filed = explode("|",$write[wr_12]);
$ext12_00  = $ex12_filed[00];
$ext12_01  = $ex12_filed[01];
$ext12_02  = $ex12_filed[02];
$ext12_03  = $ex12_filed[03];

/////////////스크립트 부분///////////// 
function calculate()
{
  ext11_01 = document.getElementById('ext11_01'); 
  ext11_03 = document.getElementById('ext11_03'); 
  ext11_05 = document.getElementById('ext11_05'); 
  ext11_07 = document.getElementById('ext11_07'); 
  ext12_00 = document.getElementById('ext12_00');
  ext12_00.value = eval(ext11_01.value*3.50) + eval(ext11_03.value*4.00) + eval(ext11_05.value*5.00) + eval(ext11_07.value*6.00); 
}

///////////////////php 부분/////////////////////////

<tr><td colspan="5" bgcolor="cccccc" align="right">총무게 :  <input type="text" name="ex12_00" id=ext12_00 class="ed" onkeyup="calculate();" onkeypress="number();" readonly style="width:50px" value="<?=$ext12_00 ?>">
                                   KG </td></tr>

-------------------------------------------------------------------------------------------------------

이 질문에 댓글 쓰기 :

답변을 작성하시기 전에 로그인 해주세요.
전체 5

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT