php 구문 질문드립니다.

php 구문 질문드립니다.

QA

php 구문 질문드립니다.

답변 3

본문

에디터에 글내용이 없으면 내용을 입력해주십시오. 라고 경고창이 나오는데

 

여기에 번역문구 때문에 if문을 사용하고 싶은데 어떻게 적용을 해야하는지모르겠습니다.

 

위 코드를 밑에 코드 처럼 if문을 적용하고 싶은데 적용할수있는 php 구문? 이있을까요

 

 


//  textarea 의 값이 비어 있는지 검사 hyun
function 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}_editor_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";
    }
}
 

 

 

 


//  textarea 의 값이 비어 있는지 검사 hyun
function 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}_editor_data || jQuery.inArray({$id}_editor_data.toLowerCase(), [' ','  ','   ','<p> </p>','<p>  </p>','<p>   </p>','<p>    </p>','<p><br></p>','<p></p>','<br>']) != -1) { 


if($text=="kr"){
alert(\"내용을 입력해 주십시오.\");

}
if($text=="en"){ 
alert(\"eeeee.\");

}
 
 oEditors.getById['{$id}'].exec('FOCUS'); return false; }\n";
    } else {
        return "if (!{$id}_editor.value) { alert(\"내용을 입력해 주십시오.\"); {$id}_editor.focus(); return false; }\n";
    }
}
 

 

 

 

 

 

이 질문에 댓글 쓰기 :

답변 3

1. 브라우저가 실행되는 ip 대역의 국가를 비교해서 조건을 거는 방법

2. 브라우저 기본 언어를 확인해서 그것에 따라 조건을 거는 방법

3. 그외 ...

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 2,725
© SIRSOFT
현재 페이지 제일 처음으로