📄 js.js
字号:
document.forms(FormName2).elements(sYear).value=FeeInputs.sYear.value;
document.forms(FormName2).elements(sMonth).value=FeeInputs.sMonth.value;
document.forms(FormName2).Page.value=FeeInputs.Page.value;
*/
}
//函数名:CheckDate
//功能介绍:检查是否为日期
//参数说明:要检查的字符串
//返回值:0:不是日期 1:是日期
function CheckDate(datestr){
var lthdatestr;
if (datestr != ""){
lthdatestr= datestr.length ;
}else{
lthdatestr=0;
}
var tmpy="";
var tmpm="";
var tmpd="";
var status;
status=0;
if ( lthdatestr== 0){
return 1; //允许空为1,否则为0
}
for (i=0;i<lthdatestr;i++){
if (datestr.charAt(i)== '-'){
status++;
}
if (status>2){
return 0;
}
if ((status==0) && (datestr.charAt(i)!='-')){
tmpy=tmpy+datestr.charAt(i)
}
if ((status==1) && (datestr.charAt(i)!='-')){
tmpm=tmpm+datestr.charAt(i)
}
if ((status==2) && (datestr.charAt(i)!='-')){
tmpd=tmpd+datestr.charAt(i)
}
}
year=new String (tmpy);
month=new String (tmpm);
day=new String (tmpd)
if ((tmpy.length!=4) || (tmpm.length>2) || (tmpd.length>2)){
return 0;
}
if (!((1<=month) && (12>=month) && (31>=day) && (1<=day))){
return 0;
}
if (!((year % 4)==0) && (month==2) && (day==29)){
return 0;
}
if ((month<=7) && ((month % 2)==0) && (day>=31)){
return 0;
}
if ((month>=8) && ((month % 2)==1) && (day>=31)){
return 0;
}
if ((month==2) && (day==30)){
return 0;
}
return 1;
}
//检查起始时间是否合法 样式2001-12-7
//OnClick="SubmitFeeInput('Search','sLogTime','sLogTime2');return false;"
function SubmitFeeInput(FormName,EleName,EleName2,EleName3)
{
var StarTime=document.forms(FormName).elements(EleName).value;
var EndTime=document.forms(FormName).elements(EleName2).value;
var sMobileNumber=document.forms(FormName).elements(EleName3).value;
/*
if ( isNaN(sMobileNumber))
{
alert("号码必须为数字!");
document.forms(FormName).elements(EleName3).value="";
document.forms[FormName].elements(EleName3).focus();
return (false);
}
if(sMobileNumber.length!=0)
{
if (sMobileNumber.length!=11&&sMobileNumber.length!=8)
{
alert("号码位数不对!");
document.forms(FormName).sMobileNumber.value="";
document.forms[FormName].sMobileNumber.focus();
return (false);
}
}
*/
if(CheckDate(StarTime)!=1)
{
alert("开始日期不合法!");
document.forms(FormName).elements(EleName).value="";
document.forms(FormName).elements(EleName).focus();
return false;
}else if(CheckDate(EndTime)!=1)
{
alert("结束日期不合法!");
document.forms(FormName).elements(EleName2).value="";
document.forms(FormName).elements(EleName2).focus();
return false;
}else
{
document.forms(FormName).submit();
}
}
///////////下拉框改变时提交FORM
function ChangeSelect(FormName)
{
document.forms[FormName].submit();
}
//检查起始时间是否合法 样式2001-12-7
//OnClick="SubmitRatio('Ratio');return false;"
function SubmitRatio(FormName)
{
if (isNaN(document.forms[FormName].sRatio130.value)||document.forms[FormName].sRatio130.value>=1||document.forms[FormName].sRatio130.value<0)
{
alert("只能输入0-1之间的小数!");
document.forms(FormName).sRatio130.value="";
document.forms(FormName).sRatio130.focus();
return (false);
}else if (isNaN(document.forms[FormName].sRatio133.value)||document.forms[FormName].sRatio133.value>=1||document.forms[FormName].sRatio133.value<0)
{
alert("只能输入0-1之间的小数!");
document.forms(FormName).sRatio133.value="";
document.forms(FormName).sRatio133.focus();
return (false);
}else if (isNaN(document.forms[FormName].sRatio193.value)||document.forms[FormName].sRatio193.value>=1||document.forms[FormName].sRatio193.value<0)
{
alert("只能输入0-1之间的小数!");
document.forms(FormName).sRatio193.value="";
document.forms(FormName).sRatio193.focus();
return (false);
}
Msg="正确吗?\n130的比率是"+document.forms(FormName).sRatio130.value +"\n";
Msg=Msg+"133的比率是"+document.forms(FormName).sRatio133.value +"\n";
Msg=Msg+"193的比率是"+document.forms(FormName).sRatio193.value +"\n";
if (confirm(Msg))
{
document.forms(FormName).submit();
}
else
{
history.go(1)
}
}
function Msg(sMsg)
{
//<div id="MsgBox" style="position:absolute; left:150px; top:160px;background-color: #33FFFF;layer-background-color: #33FFFF; display: none"></Div>
window.MsgBox.innerText=sMsg;
window.MsgBox.style.display="block";
}
function MsgH(sMsg)
{
// window.MsgBox.style.display="none";
}
function isNum(ThisForm,FromElement)
{
var f = ThisForm;
var v=f.elements[FromElement].value;
if(isNaN(v))
{
f.elements[FromElement].value="";
WaitMsg(ThisForm,"请输入整数");
f.elements['FromElement'].disabled=true; //为什么没效果?
}
// else
// {MsgH();}
}
//检查起始时间是否合法 样式2001-12-7
//OnClick="SubmitFeeInput('Search','sLogTime');return false;"
function isDate(ThisForm,FromElement)
{
var f = ThisForm;
var v=f.elements[FromElement].value;
if(v==""||v==null)
{
f.elements[FromElement].value="";
f.elements[FromElement].focus();
WaitMsg(ThisForm,"请输入yyyy-mm-dd型日期");
}
if(CheckDate(v)!=1)
{
f.elements[FromElement].value="";
f.elements[FromElement].focus();
WaitMsg(ThisForm,"请输入yyyy-mm-dd型日期");
}
}
function opendiv(div){
//alert(div+"_close");
document.all["div_"+div+"_close"].style.clip="rect(0 0 0 0)";
//alert("hi");
document.all["div_"+div+"_close"].style.display="block";
document.all["div_"+div+"_open"].style.display="none";
}
function closediv(div){
document.all["div_"+div+"_open"].style.clip="rect(0 0 0 0)";
document.all["div_"+div+"_open"].style.display="block";
document.all["div_"+div+"_close"].style.display="none";
}
function selectpoint(div,layer,divnumber){
//alert(divnumber=="2");
opendiv(div+"_select_close");
if(divnumber=="2"){
opendiv(div+"_select_open");
}
if (document.Tree.currentpoint.value!=""){
closediv(document.Tree.currentpoint.value+"_select_close");
//alert("here");
if(document.Tree.currentdivnumber.value=="2"){
closediv(document.Tree.currentpoint.value+"_select_open");
}
}
document.Tree.currentpoint.value=div;
document.Tree.currentlayer.value=layer;
document.Tree.currentdivnumber.value=divnumber;
//alert(document.Tree.currentlayer.value);
}
//检查起始时间是否合法 样式2001-12-7
//OnClick="SubmitFeeInput('Search','sLogTime');return false;"
function SubmitFeeInput2(FormName,EleName)
{
var StarTime=document.forms(FormName).elements(EleName).value;
if(StarTime==""||StarTime==null)
{
alert("日期不能为空!");
return false;
}
if(CheckDate(StarTime)!=1)
{
alert("日期不合法!");
document.forms(FormName).elements(EleName).value="";
document.forms(FormName).elements(EleName).focus();
return false;
}else
{
document.forms(FormName).submit();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -