, , , ip, , , , , 0-9 , , )
/************************************************************************************
: existChinese(strValue)
:
: strValue--- ; ;
: ; true-- ; false--
:
:
**************************************************************************************/
function existChinese(strValue)
{
var chrCode
for(var iChar = 0; iChar < strValue.length; iChar++)
{
chrCode = strValue.charCodeAt(iChar);
if(parseInt(chrCode) > 255)
{
return true;
}
}
return false;
}
/********************************************************************************
**
*
*/
function openWindow(i_URL, i_Width, i_Height) {
openWindow(i_URL, i_Width, i_Height, null, null);
}
function openWindow(i_URL, i_Width, i_Height, i_Feature) {
openWindow(i_URL, i_Width, i_Height, null, i_Feature);
}
function openWindow(i_URL, i_Width, i_Height, i_WindowName, i_Feature)
{
var v_URL = i_URL;
var v_Width = i_Width;
var v_Height = i_Height;
var v_WindowName = i_WindowName;
var v_Top;
var v_Left;
var v_Feature = "";
if (v_WindowName == null) {
v_WindowName = "myWindow";
}
var objWindow
if (!objWindow || objWindow.closed)
{
v_Top = screen.availHeight / 2 - v_Height / 2 - 30;
v_Left = screen.availWidth / 2 - v_Width / 2;
v_Feature += "top=" + v_Top + ",";
v_Feature += "left=" + v_Left + ",";
v_Feature += "width=" + v_Width + ",";
v_Feature += "height=" + v_Height + ",";
if (i_Feature == null) {
v_Feature += "directories=no,fullscreen=no,resizable=no,scrollbars=yes,status=1";
} else {
v_Feature += i_Feature;
}
objWindow = window.open(v_URL, v_WindowName, v_Feature);
//objWindow=window.open (v_URL,v_WindowName,"directories=no,fullscreen=no,resizable=no,scrollbars=no,status=1");
//v_Top=screen.availHeight/2-v_Height/2;
//v_Left=screen.availWidth/2-v_Width/2;
//objWindow.moveTo(v_Left,v_Top);
//objWindow.resizeTo(v_Width,v_Height);
objWindow.outerWidth = screen.availWidth;
objWindow.outerHeight = screen.availHeight - 25;
} else {
objWindow.focus();
}
objWindow.focus();
}
/************************************************************************************
: trim(strValue)
:
: strValue--- ; ;
:
:
:
**************************************************************************************/
function trim(strValue)
{
var iLTR, jRTL;
var chr;
//
for( iLTR = 0; iLTR < strValue.length; iLTR++ )
{
chr = strValue.charAt(iLTR) ;
if( chr != " " ) break;
}
if( iLTR == strValue.length ) return "";
//
for( jRTL = strValue.length - 1; jRTL >= 0; jRTL-- )
{
chr = strValue.charAt(jRTL);
if( chr != " " ) break;
}
return strValue.substring(iLTR, jRTL + 1);
}
/*
* ip
*/
function checkIp(strIP) {
if (isEmpty(strIP)) return false;
var re = /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/g // IP
if (re.test(strIP))
{
if (RegExp.$1 < 256 && RegExp.$2 < 256 && RegExp.$3 < 256 && RegExp.$4 < 256) return true;
}
return false;
}
/**
*
* @pram original_number
* @pram decimals
* @return
*/
function round_decimals(original_number , decimals)
{
var result1 = original_number * Math.pow(10 , decimals);
var result2 = Math.round(result1);
var result3 = result2 / Math.pow(10 , decimals);
return(result3);
}
/**
*
* @param field
* @return true/false
*/
function isEmpty(field)
{
return ((field == null) || (field.length == 0) || myTrim(field)=="");
}
/**
*
* @param field
* @return true/false
*/
function isInteger(field)
{
s = myTrim(field);
var i;
if (isEmpty(field))
{
return false;
}
for (i=0; i<field.length; i++)
{
var c = field.charAt(i);
if (!isDigit(c))
{
return false;
}
if(c==0&&i==0&&field.length>1)
{
return false;
}
}
return true;
}
/**
*
* @param c
* @return true/false
*/
function isLetter(c)
{
return ( ((c >= "a") && (c <= "z")) || ((c >= "A") && (c <= "Z")) );
}
/**
* 0-9
* @param c
* @return true/false
*/
function isDigit(c)
{
return ((c >= "0") && (c <= "9"));
}