Programming

Japanese Zenkaku

★ Issue1 <SCRIPT LANGUAGE="javascript"> <!–// /** * 全角であるかをチェックします。 * * @param チェックする値 * @return ture : 全角 / flase : 全角以外 */ function checkIsZenkaku(value){ for (var i = 0; i < value.length; ++i){ var c = value.charCodeAt(i); // 半角カタカナは不許可 if (c < 256 || (c >= 0xff61 && c <= 0xff9f)){ return false; } } return true; }   function check() { if (checkIsZenkaku(document.all.textbox.value)) { alert("指定の文字全ては全角です"); } else { alert("指定の文字に全角以外の文字が含まれています"); } } //–> </SCRIPT>   ★ Issue2 <script language="javascript"> <!–// /** JavaScript 入力文字列内に全角文字が含まれていたら警告する **/ function Check(){ var str = document.all.textbox.value; for(i=0;i<str.length;i++){ if(escape(str.charAt(i)).length>=4){ alert("全角文字が含まれています"); document.frmForm.txtText.value = ""; return; } } alert("全角文字は含まれていません"); } //–> </script>   <INPUT TYPE="text" NAME="textbox" STYLE="ime-mode:disabled" >   […]

Posted in jQuery, Javascript | Comments Off on Japanese Zenkaku

Change Date/Time Format

Ex) 20130505 -> 2013-05-05 <script language="javascript"> function chkDate(obj) { var input = obj.value.replace(/-/g,""); var inputYear = input.substr(0,4); var inputMonth = input.substr(4,2) – 1; var inputDate = input.substr(6,2); var resultDate = new Date(inputYear, inputMonth, inputDate); if ( resultDate.getFullYear() != inputYear || resultDate.getMonth() != inputMonth || resultDate.getDate() != inputDate) { obj.value = ""; } else { obj.value = inputYear + "-" + input.substr(4,2) + "-" + inputDate; } } </script><script language="javascript"> function chkDate(obj) { var input = obj.value.replace(/-/g,""); var inputYear = input.substr(0,4); var inputMonth = input.substr(4,2) – 1; var inputDate = input.substr(6,2); var resultDate = new Date(inputYear, inputMonth, inputDate); if ( resultDate.getFullYear() != inputYear || resultDate.getMonth() != inputMonth || resultDate.getDate() != inputDate) […]

Posted in jQuery, Javascript | Comments Off on Change Date/Time Format

str_replace, substr ,strpos, explode

\d – 메타문자는 0-9까지의 숫자위치확인 \w – a~z 알파벳 대소문자의 위치를확인 \s – 띄어쓰기를 확인 ^  – 문자열의 시작 $ – 문자열의 마지막 /\d{10}/  -패턴에서 {10} 가 수량자 {최소,최대} -반복을 나타냄 +  -반드시 1회이상 등장 의미 * – 1회또는 그 이상 등장해고 상관없음 ? – 1회또는 아예 등장하지 말아할것 [a-d] -소문자 a 에서부터 a b c d 까지만 허용 [^a-d] -삿갓은 문자열의 시작 -하지만 문자열클래스에서는 허용 하지않겠다는 의미(a b c d 를 허용 안함) 1. 먼저 문자열을 정리하는 함수입니다. $result = trim($string) – 문자열 앞,뒤 에있는 공백문자를 지웁니다. $result = ltrim($string) – 문자열 앞에 들어가는 공백문자를 지웁니다. $result = chop($string) – 문자열 뒤에 들어가는 공백문자를 지웁니다. 공백문자 – 줄바꿈 개행문자, […]

Posted in PHP | Comments Off on str_replace, substr ,strpos, explode

Drupal Views tutorials

Views getting started Web Developer Looks at Drupal Views: Power and Flexibility from www.htmlgoodies.com Using Drupal 6 Views To Create Offset Recent Posts from www.glennburks.com Creating a CCK and Views powered Drupal site from www.davidnewkerk.com Using Views 2 in Drupal 6 to replace the Tracker module from davidherron.com Tutorial: Simple news view with drupal from www.webdo.me Create administration pages with Views 2 from zugec.com How to create a simple news archive in Drupal from drupalsn.com Alphabetical Sorting of Drupal Nodes Using Views from www.ostraining.com Views Theming Rewriting Drupal Views Output for Custom Theming & CSS from highrockmedia.com Theming Views 2 – The Basics from group42.ca Drupal 6: How to quickly theme a view ? from stackoverflow.com Drupal views theming – rows in tables from www.maybeor.com Theming Views on Drupal 6 (the simple way) from www.appnovation.com Theming […]

Posted in Drupal | Comments Off on Drupal Views tutorials

Search in Chinese / Japanese

in search.module change $keys = str_replace(“*”, “%”, $keys); to $keys = ‘%’.str_replace(“*”, “%”, $keys).’%’;

Posted in Drupal | No Comments »

Float Problem

Case as below. <div class="non-floated-parent" style="background-color:#333; border:1px solid #900;"> <div class="floated-child" style="float:left; width:200px; height:200px; background-color:#000;"> This is a floated element as "float:left; width:200px; height:200px; background-color:#000;" </div> </div><div class="non-floated-parent" style="background-color:#333; border:1px solid #900;"> <div class="floated-child" style="float:left; width:200px; height:200px; background-color:#000;"> This is a floated element as "float:left; width:200px; height:200px; background-color:#000;" </div> </div> This is a floated element as “float:left; width:200px; height:200px; background-color:#000;” Solution 1. Use The clear fix <div class="non-floated-parent" style="background-color:#333; border:1px solid #900;"> <div class="floated-child" style=" float:left; width:200px; height:200px; background-color:#000;"> This is a floated element as "float:left; width:200px; height:200px; background-color:#000;" </div>   <div style="clear: both; "></div>   </div><div class="non-floated-parent" style="background-color:#333; border:1px solid #900;"> <div class="floated-child" style=" float:left; width:200px; height:200px; background-color:#000;"> This […]

Posted in CSS | Comments Off on Float Problem

Feeds Node Processor

Allow User Name and Email case ‘user_name’: if ($user = user_load_by_name($value)) { $target_node->uid = $user->uid; } break; case ‘user_mail’: if ($user = user_load_by_mail($value)) { $target_node->uid = $user->uid; } break;case ‘user_name’: if ($user = user_load_by_name($value)) { $target_node->uid = $user->uid; } break; case ‘user_mail’: if ($user = user_load_by_mail($value)) { $target_node->uid = $user->uid; } break; public function getMappingTargets() { $targets[’user_name’] = array( ‘name’ => t(’LID’), ‘description’ => t(’The Drupal LID of the node author.’), ); $targets[’user_mail’] = array( ‘name’ => t(’User email’), ‘description’ => t(’The Drupal email address of the node author.’), );public function getMappingTargets() { $targets[‘user_name’] = array( ‘name’ => t(‘LID’), ‘description’ => t(‘The Drupal LID of the node author.’), ); $targets[‘user_mail’] […]

Posted in Drupal | Comments Off on Feeds Node Processor