s

if문 쓰는방법 문의

· 2013-11-19 (화) 12:54:27 · 2760 · 7
팝업창뜰때 음성파일을 tmpstr[?] ?에 내용이 0개 이상일경우 Sound.play를 다르게적용하고싶은데요
현재는 팝업이뜨면 Sound.play(g4_path + "/js/recv_mail.mp3"); 만실행중이거든요

re.html에 내용이 잇을경우 Sound.play(g4_path + "/js/re.mp3"); 실행
ex.html에 내용이 잇을경우 Sound.play(g4_path + "/js/exmp3"); 실행
free.html에 내용이 잇을경우 Sound.play(g4_path + "/js/free.mp3"); 실행
one.html에 내용이 잇을경우 Sound.play(g4_path + "/js/one.mp3"); 실행
이런게실행시키는 방법좀 부탁드립니다.




========================================================================

function newArticleCheck() {
$j.post( g4_path+"/ajax.newUpdateCheck.php",
function(data){
tmpstr = data.split("|");
var divToday = $j('#divToday');
var re = $j(".re_value");
var ex = $j(".ex_value");
var free = $j(".free_value");
var one = $j(".one_value");

if(tmpstr[0] != 0 || tmpstr[1] != 0 || tmpstr[2] != 0 || tmpstr[3] != 0){

divToday.show();

re.html("<font color=red><b>" + tmpstr[1] + "</b></font>");

ex.html("<font color=red><b>" + tmpstr[0] + "</b></font>");

free.html("<font color=red><b>" + tmpstr[2] + "</b></font>");

one.html("<font color=red><b>" + tmpstr[3] + "</b></font>");

Sound.play(g4_path + "/js/recv_mail.mp3");
}else{
divToday.hide();
}
});
}
|

댓글 7개

될지 안될지는 모르지만 투척하고 갑니다..

if (re.html("<font color=red><b>" + tmpstr[1] + "</b></font>").length){ // .length 로 있는지 없는지 확인
Sound.play(g4_path + "/js/recv_mail.mp3");
}
아래처럼해봣는데 안되네요
4개의 음성파일을 다불러오네요

if (re.html("<font color=red><b>" + tmpstr[1] + "</b></font>").length)
{ // .length 로 있는지 없는지 확인
Sound.play(g4_path + "/js/re.mp3");
}

if (ex.html("<font color=red><b>" + tmpstr[0] + "</b></font>").length)
{ // .length 로 있는지 없는지 확인
Sound.play(g4_path + "/js/ex.mp3");
}


if (free.html("<font color=red><b>" + tmpstr[2] + "</b></font>").length)
{ // .length 로 있는지 없는지 확인
Sound.play(g4_path + "/js/free.mp3");
}

if (one.html("<font color=red><b>" + tmpstr[3] + "</b></font>").length)
{ // .length 로 있는지 없는지 확인
Sound.play(g4_path + "/js/onemp3");
}
(re.html("<font color=red><b>" + tmpstr[1] + "</b></font>")).length
다사힌번봐주시면 감사하겟습니다
적용이안되서요



function newArticleCheck() {
$j.post( g4_path+"/ajax.newUpdateCheck.php",
function(data){
tmpstr = data.split("|");
var divToday = $j('#divToday');
var re = $j(".re_value");
var ex = $j(".ex_value");
var free = $j(".free_value");
var one = $j(".one_value");

if(tmpstr[0] != 0 || tmpstr[1] != 0 || tmpstr[2] != 0 || tmpstr[3] != 0){

divToday.show();

(re.html("<font color=red><b>" + tmpstr[1] + "</b></font>")).length

{ // .length 로 있는지 없는지 확인
Sound.play(g4_path + "/js/re.mp3");
}

(ex.html("<font color=red><b>" + tmpstr[0] + "</b></font>")).length

{ // .length 로 있는지 없는지 확인
Sound.play(g4_path + "/js/ex.mp3");
}


(free.html("<font color=red><b>" + tmpstr[2] + "</b></font>")).length

{ // .length 로 있는지 없는지 확인
Sound.play(g4_path + "/js/free.mp3");
}

(one.html("<font color=red><b>" + tmpstr[3] + "</b></font>")).length

{ // .length 로 있는지 없는지 확인
Sound.play(g4_path + "/js/one.mp3");
}

}else{
divToday.hide();
}
});
}
헐킈.... 이렇게 하실줄이야 ..ㅋㅋㅋ

if ((re.html("<font color=red><b>" + tmpstr[1] + "</b></font>").length)) { // .length 로 있으면 사운드 플레이
Sound.play(g4_path + "/js/re.mp3");
}

이렇게 하나만 되는지 안되는지 확인해보세요.
네 1개는 작동합니다.. 근데 4개로하면 다불러와서여
if를 4개 사용하지 마시고 if다음에 오는 if는 else if로 해보세요..
앞에껄 충족시키지 못할 경우에만 다음 구문으 실행합니다.
댓글을 작성하시려면 로그인이 필요합니다.

그누4 질문답변

66,531건

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

+
제목 글쓴이 날짜 조회
13-11-19 조회 1,798
13-11-19 조회 1,398
13-11-19 조회 1,825
13-11-19 조회 1,805
13-11-19 조회 1,766
13-11-19 조회 1,441
13-11-19 조회 2,515
13-11-19 조회 1,761
13-11-19 조회 2,545
13-11-19 조회 1,755
13-11-19 조회 1,711
13-11-19 조회 2,761
13-11-19 조회 1,885
13-11-19 조회 1,826
13-11-19 조회 1,872
13-11-19 조회 1,468
13-11-19 조회 1,662
13-11-19 조회 2,296
13-11-19 조회 2,138
13-11-18 조회 4,854