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

· 2013-08-26 (월) 03:07:20 · 2188 · 3
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개

2013-08-26 (월) 09:53:37
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);
}
로 고쳐보았는데도 안되서 계속 고민중입니다 ㅡㅜ..
2013-08-26 (월) 11:47:02
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 질문답변

66,531건

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

+
제목 글쓴이 날짜 조회
13-08-26 조회 912
13-08-26 조회 836
13-08-26 조회 884
13-08-26 조회 1,643
13-08-26 조회 1,854
13-08-26 조회 2,122
13-08-26 조회 1,070
13-08-26 조회 845
13-08-26 조회 1,603
13-08-26 조회 1,740
13-08-26 조회 1,090
13-08-26 조회 1,314
13-08-26 조회 1,066
13-08-26 조회 1,193
13-08-26 조회 2,189
13-08-26 조회 1,862
13-08-25 조회 1,830
13-08-25 조회 2,703
13-08-25 조회 1,725
13-08-25 조회 1,731