13번라인에
!= -1) { alert(\"내용을 입력해 주십시오.\"); oEditors.getById['{$id}'].exec('FOCUS'); return false; }\n";
alert(\"내용을 입력해 주십시오.\");
이 내용을 번역으로 적용 하려고 합니다.
!= -1) {
if($lang =="kr") {alert(\"안녕.\");}
if($lang =="en") { alert(\"hi.\");}
oEditors.getById['{$id}'].exec('FOCUS'); return false; }\n";
위처럼 하면 kr일때는 안녕으로 나오고 en일때는 hi라는 문구로 경고창 문구를 변경하고 싶은데 Retun"" 안에 if문을 사용하는 방법이 있는지 질문드립니다 ^^;
설명이 너무 복잡한것같은데 이게 설명이 어렵네요 ^^;;
- 원본 소스
// textarea 의 값이 비어 있는지 검사 hyunfunction chk_editor_js($id, $is_dhtml_editor=true){ if ($is_dhtml_editor) { return " var {$id}_editor_data_txt = {$id}_editor_data.toLowerCase();\n; {$id}_editor_data_txt = {$id}_editor_data_txt.replace(/\<p\>/gi, '');\n; {$id}_editor_data_txt = {$id}_editor_data_txt.replace(/\<br\>/gi, '');\n; {$id}_editor_data_txt = {$id}_editor_data_txt.replace(/\<\/p\>/gi, '');\n; {$id}_editor_data_txt = {$id}_editor_data_txt.replace(/ /gi, '');\n; {$id}_editor_data_txt = {$id}_editor_data_txt.replace(/ /gi, '');\n; if (!{$id}_editor_data_txt || !{$id}_edito r_data || jQuery.inArray({$id}_editor_data.toLowerCase(), [' ',' ',' ','<p> </p>','<p> </p>','<p> </p>','<p> </p>','<p><br></p>','<p></p>','<br>']) != -1) { alert(\"내용을 입력해 주십시오.\"); oEditors.getById['{$id}'].exec('FOCUS'); return false; }\n"; } else { return "if (!{$id}_editor.value) { alert(\"내용을 입력해 주십시오.\"); {$id}_editor.focus(); return false; }\n"; }}
답변 2개 / 댓글 1개
리턴 전에 변수에 담아서 처리하는 것이 좋을 것 같네요.
$alt_str = "";if($lang =="kr") $alt_str = "안녕";else if($lang =="en") $alt_str = "hi";alert($alt_str);
답변에 대한 댓글 1개
그냥 엘스 안에 이렇게 느면안되요?
if($lang =="kr") {alert(\"안녕.\");}
if($lang =="en") { alert(\"hi.\");}
답변을 작성하려면 로그인이 필요합니다.