// 共通関数 //ページ数変更してsubmit function changePage(frm, npage) { document.hnFormP.page.value = npage; if(document.getElementsByTagName("select")){ if(document.getElementsByTagName("select").cmbsrt1) document.hnFormP.cmbsrt1.value = document.getElementsByTagName("select").cmbsrt1.value; if(document.getElementsByTagName("select").cmbsrt2) document.hnFormP.cmbsrt2.value = document.getElementsByTagName("select").cmbsrt2.value; if(document.getElementsByTagName("select").cmbsrt3) document.hnFormP.cmbsrt3.value = document.getElementsByTagName("select").cmbsrt3.value; if(document.getElementsByTagName("select").cmbsrt4) document.hnFormP.cmbsrt4.value = document.getElementsByTagName("select").cmbsrt4.value; if(document.getElementsByTagName("select").cmbsrt5) document.hnFormP.cmbsrt5.value = document.getElementsByTagName("select").cmbsrt5.value; if(document.getElementsByTagName("select").cmbsrt6) document.hnFormP.cmbsrt6.value = document.getElementsByTagName("select").cmbsrt6.value; if(document.getElementsByTagName("select").cmbsrt7) document.hnFormP.cmbsrt7.value = document.getElementsByTagName("select").cmbsrt7.value; if(document.getElementsByTagName("select").cmbsrt8) document.hnFormP.cmbsrt8.value = document.getElementsByTagName("select").cmbsrt8.value; } document.hnFormP.submit(); } // アルファベットチェック function IsAlph(str) { if (str.match(/[^a-z|^A-Z]/g)) { return false; } return true; } // 半角数字チェック関数 function IsHanNum(str) { if (str.match(/^\d+$/)) { return true; } return false; } // 半角英数チェック関数 function IsHanAlphNum(str) { if (str.match(/^\w+$/)) { return true; } return false; } // 半角カタカナチェック関数 function IsHanKata(str) { var i, c; for (i = 0; i < str.length; i++) { c = str.charAt(i); if (c < '、' || c > '゚') { return false; } } return true; } // 全角チェック関数 function IsZen(str) { var i, c; for (i = 0; i < str.length; i++) { c = str.charCodeAt(i); // 半角カタカナは不許可 if (c < 256 || (c >= 0xff61 && c <= 0xff9f)) { return false; } } return true; } // 日付チェック関数 function IsDate(str) { // 変数宣言 var year, mon, mday; // 書式チェック if (str.match(/^(\d{4})\/(\d{1,2})\/(\d{1,2})$/)) { year = RegExp.$1; mon = RegExp.$2; mday = RegExp.$3; } else if (str.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/)) { year = RegExp.$1; mon = RegExp.$2; mday = RegExp.$3; } else if (str.match(/^(\d{4})(\d{2})(\d{2})$/)) { year = RegExp.$1; mon = RegExp.$2; mday = RegExp.$3; } else { return false; } // 日付の正当性チェック if (_IsDate(year, mon, mday) == false) { return false; } return true; } // 日付正当性チェック関数 function _IsDate(year, mon, mday) { // 変数宣言 var mend; // 文字列に型変換 year += ''; mon += ''; mday += ''; // 書式チェック if (year.match(/^\d{1,4}$/) == null) { return false; } if (mon.match(/^\d{1,2}$/) == null) { return false; } if (mday.match(/^\d{1,2}$/) == null) { return false; } // 先頭の0を消去 year = year.replace(/^0*(\d+)$/, '$1'); mon = mon.replace(/^0/, ''); mday = mday.replace(/^0/, ''); // 数値に型変換 // year -= 0; // mon -= 0; // mday -= 0; // 年範囲チェック // if (!(year >= 1900 && year <= 3000)) { // return false; // } // 月範囲チェック if (!(mon >= 1 && mon <= 12)) { return false; } // 月末配列 mends = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); // 月末の決定 if ((((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) && mon == 2) { mend = 29; } else { mend = mends[mon - 1]; } // 日範囲チェック if (!(mday >= 1 && mday <= mend)) { return false; } return true; } // 和暦チェック関数 function IsJpDate(gen, year, mon, mday) { // 変数宣言 var dt, dt2, dt3; // 文字列に型変換 year += ''; mon += ''; mday += ''; // 書式チェック if (year.match(/^\d{1,3}$/) == null) { return false; } if (mon.match(/^\d{1,2}$/) == null) { return false; } if (mday.match(/^\d{1,2}$/) == null) { return false; } // 先頭の0を消去 year = year.replace(/^0*(\d+)$/, '$1'); mon = mon.replace(/^0/, ''); mday = mday.replace(/^0/, ''); // 数値に型変換 year -= 0; mon -= 0; mday -= 0; // 元号毎の設定 if (gen == 1) { year += 1925; dt2 = new Date(1926, 11, 25); dt3 = new Date(1989, 0, 7); } else if (gen == 2) { year += 1988; dt2 = new Date(1989, 0, 8); dt3 = new Date(2999, 12, 31); } else if (gen == 3) { year += 1867; dt2 = new Date(1868, 8, 8); dt3 = new Date(1912, 6, 30); } else if (gen == 4) { year += 1911; dt2 = new Date(1912, 6, 30); dt3 = new Date(1926, 11, 25); } else { return false; } // 西暦正当性チェック if (_IsDate(year, mon, mday) == false) { return false; } // 引数の年月日でオブジェクト生成 dt = new Date(year, mon - 1, mday); // 和暦正当性チェック if (dt.getTime() >= dt2.getTime() && dt.getTime() <= dt3.getTime()) { return true; } return false; } // 時刻形式のチェック function IsHour(str) { var hour, min; // 文字列に型変換 hour += ''; min += ''; if (str.match(/^(\d{2}):(\d{1,2})$/)) { hour = RegExp.$1; min = RegExp.$2; } else if (str.match(/^(\d{2})(\d{2})$/)) { hour = RegExp.$1; min = RegExp.$2; } else { return false; } // 時刻の正当性チェック if (_IsHour(hour, min) == false) { return false; } return true; } // 時刻の正当性チェック function _IsHour(hour, min) { // 書式チェック if (hour.match(/^\d{1,2}$/) == null) { return false; } if (min.match(/^\d{1,2}$/) == null) { return false; } // 先頭の0を消去 hour = hour.replace(/^0/, ''); min = min.replace(/^0/, ''); // 時範囲チェック if (!(hour >= 0 && hour <= 23)) { return false; } // 分範囲チェック if (!(min >= 0 && min <= 59)) { return false; } return true; } // IPアドレスチェック function IsIP(str) { if (!str.match(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/)) { return true; } return false; } // メールアドレスチェック function IsMail(str) { if (!str.match(/[!#-9A-~]+@[a-z0-9\-\_]+\.+[a-z0-9]+/i)) { return true; } return false; } // 文字列バイト数チェック function StrLen(str) { //function StrLen(str, len, i) { var len = 0; str = escape(str); for (var i=0; i 0) { if (flg != 1) { str2 = str2 + rep; } else { flg = 0; } idx = str.indexOf(fin); if (idx < 0) { str2 = str2 + str; break; } //検索文字列まで str2 = str2 + str.substring(0, str.indexOf(fin)); //検索文字列よりあと str = str.substring(str.indexOf(fin)+1, str.length); len = str.length; } return str2; } //各種バーの表示制御 function barVisible() { window.locationbar.visible = false; window.menubar.visible = false; window.personalbar.visible = false; window.statusbar.visible = false; window.toolbar.visible = false; window.scrollbars.visible = true; } // OpenWindow var nw=0; /** * 詳細をNewWindowで開く * * @param string url * @param integer width * @param integer height * @param (optional) string window's name */ function OpenWindowFree(url,w,h) { var winname = "info"; if (OpenWindowFree.arguments.length > 3) winname = OpenWindowFree.arguments[3]; nw = window.open(url,winname,"toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width="+w+",height="+h); nw.moveTo(20, 20); nw.focus(); } function OpenWindowFree2(url,w,h) { var winname = "info"; if (OpenWindowFree2.arguments.length > 3) winname = OpenWindowFree2.arguments[3]; try { nw = window.open(url,winname,"toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width="+w+",height="+h); nw.moveTo(20, 20); nw.focus(); } catch(e) { //特に無し } } // NewWindow開く(サイズ固定) function OpenWindow(url) { nw = window.open(url,"detail2","toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=1000,height=710"); //nw = window.open(url,"detail2","scrollbars=yes,resizable=yes,width=1000,height=710"); nw.moveTo(0, 0); nw.focus(); } // NewWindow開く(サイズ固定) function OpenWindowEntry(url) { nw = window.open(url,"entry","toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=1000,height=710"); //nw = window.open(url,"entry","scrollbars=yes,resizable=yes,width=1000,height=710"); nw.moveTo(0, 0); nw.focus(); } // NewWindow開く(TOP画面) function OpenWindowTop() { url = "topPage.html"; //url = "control.php?&next=0&pid=-1"; nw = window.open(url,"detail","toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=1000,height=710"); //nw = window.open(url,"detail","toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=1000,height=710"); nw.moveTo(0, 0); nw.focus(); } // NewWindow開く(ログイン画面) function OpenWindowLogin() { url = "control.php?uniqprm=1&next=1&pid=0"; nw = window.open(url,"detail","toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=1000,height=710"); //nw = window.open(url,"detail","toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=1000,height=710"); nw.moveTo(0, 0); nw.focus(); } // NewWindow開く(印刷画面) function OpenWindowPrint(url) { nw = window.open(url,"print","toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=700,height=680"); //nw = window.open(url,"print","toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=700,height=680"); nw.moveTo(30, 30); nw.focus(); } // NewWindow開く(印刷画面:A4横) function OpenWindowPrintSide(url) { //nw = window.open(url,"print","toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=1000,height=650"); nw = window.open(url,"print","toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=1000,height=650"); nw.moveTo(0, 30); nw.focus(); } // コメントをNewWindowで開く function OpenWindowCmt(url,w,h) { // 表示モード // 入力エリアサイズ var c = w; var r = h; if (c=='') { c = 10 * 2; } else { c = c * 2; } if (r=='') { r = 20; } // 画面サイズ var w ,h; w = c * 8; h = r * 37; url = url + '&col=' + c + '&row=' + r; nw = window.open(url,"detailcom","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,screenX=100,screenY=100,width="+w+",height="+h); nw.focus(); } // ウインドウを閉じる function CloseWindow() { if (nw.closed == false) { nw.close(); } } // 自ウインドウを閉じる function CloseMe() { if (window.closed == false) { window.close(); } } //パスワードチェック function CheckPass() { //旧パスワード var s_pas0 = document.fPassD.rPas0.value; if (s_pas0 == '') { alert("旧パスワードを入力してください。"); return false; } else { if (IsAlphNum(s_pas0)) { alert("パスワードは半角英数で入力してください。"); return false; } if (StrLen(s_pas0) > 20) { alert("パスワードは半角20文字までで入力してください。"); return false; } } //新パスワード var s_pas1 = document.fPassD.rPas1.value; if (s_pas1 == '') { alert("新パスワードを入力してください。"); return false; } else { if (IsAlphNum(s_pas1)) { alert("パスワードは半角英数で入力してください。"); return false; } if (StrLen(s_pas1) > 20) { alert("パスワードは半角20文字までで入力してください。"); return false; } var s_pas2 = document.fPassD.rPas2.value; if (s_pas1 != s_pas2 || s_pas2 == '') { alert("パスワードが一致していません。もう一度パスワードを入力して下さい。"); return false; } } return true; } //ブラウザチェック function CheckBrowser() { if ( window.opera ) { //Opera return false; } if (document.getElementById) { //IE5以上 or NN6以上 return true; } else { return false; } } //javascriptチェック function CheckJave() { if ( navigator.javaEnabled() ) { return true; } else { return false; } } // 終了処理(ログアウト保存ページへ) function SystemEnd() { CloseMe(); //url = "control.php?uniqprm=1&next=1&pid=0&out=1"; url="logout.php"; location.href = url; } //システム初期処理 function SystemInit(url) { FuckRightClick(); CheckSystem(url); } //システムチェック function CheckSystem() { //バー制御(非表示) //barVisible(); if ( CheckBrowser() && CheckJave() ) { return true; } else { //location.href=url; location.href="index.php"; return false; } } //システムチェック function BootControl() { if ( CheckBrowser() && CheckJave() ) { //location.href="control.php?frRegRoute=0"; //document.hnForm.submit(); //location.href="control.php?toppage=1"; OpenWindowTop(); return true; } else { return false; } } // 右クリック取得 function FuckRightClick() { if(document.all || document.getElementById){ document.onmousedown = RightClick; //右クリックイベント取得 }else if(document.layers){ window.captureEvents(Event.MOUSEDOWN); window.onmousedown = RightClick; //右クリックイベント取得 } } // 右クリック無効 function RightClick(e){ if(document.all || document.getElementById){ if(event.button & 2){ //alert("右クリック不可"); //アラート画面表示 return(false); } }else if(document.layers){ //alert("右クリック不可"); //アラート画面表示 if(e.which == 3){ return(false); } } } function testal() { alert("test"); } /** * ドキュメント内のボタンをすべてdisabledにします。 * * */ function disableAllButtons() { var fcount = document.forms.length; for (var i = 0; i < fcount; i++) { var form = document.forms[i]; var ecount = form.length; for (j = 0; j < ecount; j++) { if (form[j].type && form[j].type == 'button') form[j].disabled = true; } } } /** * ドキュメント全体を網掛けし、操作できないようにします。 * * @param b boolean trueで網掛け、falseで解除 * @param target 対象のウィンドウ */ function coverWindow(b, target) { var coverstyle = { 'position': 'fixed', 'top': '0px', 'left': '0px', 'width': '100%', 'height': '100%', 'backgroundColor': '#888', 'zIndex': '32767', 'filter': 'alpha(opacity=50)', '-moz-opacity': '0.50', 'opacity': '0.50', 'margin': '0', 'padding': '0' }; /* いったん削除 */ var cover = target.document.getElementById('mycover'); if (cover) target.document.body.removeChild(cover); if (!b) return; /* IE 6は、iframeじゃないとform要素が最前面に出てしまう */ cover = target.document.createElement('iframe'); cover.id = 'mycover'; for (var i in coverstyle) { cover.style[i] = coverstyle[i]; } /* IE 6 hack */ if (document.all) { cover.style.position = 'absolute'; cover.style.height = target.document.body.scrollHeight; cover.style.width = target.document.body.scrollWidth; } target.document.body.appendChild(cover); }