jQuery, Javascript
Japanese Hankaku
function checkhalf(str){ str = str; chkstr = escape(str.value); if (chkstr.indexOf(’%’) != -1){ alert(’入力は半角英数字でお願いします。’); str.value = ""; str.focus(); } }function checkhalf(str){ str = str; chkstr = escape(str.value); if (chkstr.indexOf(‘%’) != -1){ alert(‘入力は半角英数字でお願いします。’); str.value = ""; str.focus(); } }
Posted in jQuery, Javascript | Comments Off on Japanese Hankaku
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
Popup Window in the center
<script language=”javascript”> <!– function OpenWin() { window.open(“팝업.html”,”ow1″,”width=200,height=200,top=”+(screen.availHeight/2-100)+”,left=”+(screen.availWidth/2-100)+”");//팝업창 중앙에 띄우기 } //–> </script><script language=”javascript”> <!– function OpenWin() { window.open(“팝업.html”,”ow1″,”width=200,height=200,top=”+(screen.availHeight/2-100)+”,left=”+(screen.availWidth/2-100)+”");//팝업창 중앙에 띄우기 } //–> </script> <body leftMargin="0" topMargin=”0″ onload=”OpenWin()”> </body><body leftMargin="0" topMargin=”0″ onload=”OpenWin()”> </body> ——————————————————————————– popup.html <body> <img src=”예쁜버튼그림1.jpg” width=”10″ height=”10″ onClick=”opener.location.href=’http://www.naver.com’;window.close()” style=”cursor:hand”> <img src=”예쁜버튼그림2.jpg” width=”10″ height=”10″ onClick=”window.close()” style=”cursor:hand”> </body><body> <img src=”예쁜버튼그림1.jpg” width=”10″ height=”10″ onClick=”opener.location.href=’http://www.naver.com’;window.close()” style=”cursor:hand”> <img src=”예쁜버튼그림2.jpg” width=”10″ height=”10″ onClick=”window.close()” style=”cursor:hand”> </body>
Posted in jQuery, Javascript | Comments Off on Popup Window in the center