견적스킨 사용중에.. ie이외 브라우저에서는 합계금액이 NaN으로 뜹니다

http://cabigon.dothome.co.kr/gnuboard4/bbs/write.php?bo_table=interior

1. 위 링크를 'ie'브라우저로 보면 최하단 합계금액에 잘 표시가 됩니다..
2. 그런데 '크롬'이나 '파이어폭스' 등으로 보면 합계금액이 'NaN'으로 표시가 되서 고민끝에 글 올려봅니다..
(* '모델사용' 의 체크박스를 클릭하는건 크롬이나 파이어폭스에서도 합계금액이 잘 추가됩니다..)

3. 스킨은 http://sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=96183 의 사이트웹 님 스킨을 그대로 적용했습니다..

4. write.skin.php 상단의 자바스크립트가 합계금액 계산하는것 같아서 아래에 같이 올려봅니다..

<script>
function addPrice() {
totalPrice = 0;
for(i=0; i<fwrite.price.length; i++) {
if(!isNaN(fwrite.price[i].value)&&fwrite.price[i].value!='') {
totalPrice += fwrite.price[i].value * fwrite.price[i].itemname;
}
}
if(fwrite.모델사용.checked) totalPrice += 60000;
document.getElementById('합계금액').value = comma(totalPrice);
}
function comma(num) {
num = num.toString();
len = num.length;
str = "";
for(i=1; i<=len; i++) {
str = num.charAt(len-i)+str;
if((i%3 == 0)&&(len-i != 0)) str = ","+str;
}
return str+"원";
}
</script>

5. ie에서는 잘 표시가 되는데 다른 브라우저에서만 안되서 좌절중입니다..
부디 한번 살펴봐 주십시오
|

댓글 3개

totalPrice += fwrite.price[i].value * fwrite.price[i].itemname;

totalPrice += parseInt(변수); 로 해보세요
댓글 감사드립니다..
혹시..
'폼 태그 name 을 자바스크립트로 다이렉트로 불러올 경우 IE 외 브라우저는 인식을 못하고
폼 태그 하위에 양식 이름을 다이렉트로 불러오는 것 또한 잘못된 습관이며, 비표준이다'라고 좋으신분이 말씀해주셔서 그쪽을 보고있는 중입니다.. 그래서
function addPrice() {
totalPrice = 0;
for(i=0; i<document.forms.fwrite.elements.price.length; i++) {
if(!isNaN(document.forms.fwrite.elements.price[i].value)&&document.forms.fwrite.elements.price[i].value!='') {
totalPrice += document.forms.fwrite.elements.price[i].value * document.forms.fwrite.elements.price[i].itemname;
}
}
if(fwrite.모델사용.checked) totalPrice += 60000;
document.getElementById('합계금액').value = comma(totalPrice);
}
로 고쳐보았는데도 안되서 계속 고민중입니다 ㅡㅜ..
var prices = document.geElementsByName('price[]'); // <name = "price[]"> 인경우
for(var i in prices)
{
var price = prices[i];
if(!!price == true)
{
totalPrice += parseInt(price, 10); 이게 일반적인데,
}
}

document.forms.fwrite.elements.price[i].itemname;

이게 뭔지 모르겟군요.
댓글을 작성하시려면 로그인이 필요합니다.

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기 기존 게시물은 열람만 가능합니다.

+
제목 글쓴이 날짜 조회
12년 전 조회 2,005
12년 전 조회 969
12년 전 조회 746
12년 전 조회 1,507
12년 전 조회 1,626
12년 전 조회 990
12년 전 조회 1,210
12년 전 조회 963
12년 전 조회 1,092
12년 전 조회 2,055
12년 전 조회 1,733
12년 전 조회 1,724
12년 전 조회 2,590
12년 전 조회 1,614
12년 전 조회 1,615
12년 전 조회 1,491
12년 전 조회 976
12년 전 조회 933
12년 전 조회 766
12년 전 조회 1,189