function DWL(text) { document.write(text + "
"); } function IsOddNumber(num) { return (1 == (num % 2)); } /*-----------------------------------------------------------*/ // URL操作 // テストコード:urltest.html /*-----------------------------------------------------------*/ function SetURLText(text, key, val) { if("" == text){ text += ("&" + key + "=" +val); } else if(null == text.match("&" + key + "=")){ text += (";&" + key + "=" +val); } else { var regex = new RegExp("&"+key+"=[^;]*", "i"); text = text.replace(regex, "&"+key+"="+val); } return text; } function GetURLText(text, key) { var regex = new RegExp("&"+key+"=([^;]*)", "i"); var result = text.match(regex); if(null == result){ return undefined; } return RegExp.$1; } function SetHash(key, val) /// アンカーに文字列を追加 { location.hash = SetURLText(location.hash, key, val); } function GetHash(key) /// アンカーから文字列取得 { return GetURLText(location.hash, key); } function ClearHash(key) /// アンカーの値を消去 { return location.hash = ""; } function SetSearch(key, val) { location.search = SetURLText(location.search, key, val); } function GetSearch(key) { return GetURLText(location.search, key); } function ClearSearch() { return location.search = ""; } // Cookie操作 function GetCookie(key) /// クッキーの値を取得 { var tmp = document.cookie + ";"; var index1 = tmp.indexOf(key, 0); if(index1 != -1){ tmp = tmp.substring(index1,tmp.length); var index2 = tmp.indexOf("=",0) + 1; var index3 = tmp.indexOf(";",index2); return(unescape(tmp.substring(index2,index3))); } return(""); } function SetCookie(key, val) /// クッキーの値をセット { document.cookie = key + "=" + escape(val) + ";expires=Fri, 31-Dec-2030 23:59:59;"; } // base64文字列を16進数文字列に変換。 function Base64ToHex(base64) { var binary = base64decode(base64); var hex=""; for(i=0; i