📄 setsimpletextformula.asp
字号:
<link href="../../../include/main.css" rel="stylesheet" type="text/css">
<script src="../../../include/function.js" type="text/javascript"></script>
<script src="../../../include/textformulaedit.js" type="text/javascript"></script>
<script ID="clientEventHandlersJS" LANGUAGE="javascript">
<!--
//根据公式数据,初始化公式设置的界面,Description,FieldToFormulaSelect
function InitFormula()
{
var FormulaStr;//公式内部结构串:SQLDesc ItemSep Divisor
if (window.dialogArguments != null)
{
FormulaStr=JTrim(window.dialogArguments[0]);
if(FormulaStr.length>2)
FormulaStr=FormulaStr.substr(2); //传上来的格式为FormulaType FormulaSep SQLDesc ItemSep Divisor,去掉FormulaType|
else
FormulaStr=""
FieldToFormulaSelect.innerHTML =window.dialogArguments[1];
}
if(FormulaStr=='')
{
frmData.Description.value=''
}
else
{
var parts
parts=FormulaStr.split(ItemSep);
if(parts.length>0)
{
frmData.Description.value=FormatToCaption(parts[0]);
}
}
}
//表达式中的字段id还原成字段名称[XXX],用于在页面中显示
function FormatToCaption(Desc)
{
var Count,Caption,FieldID;
Count=frmData.FieldToTextFormula.length
for(var i=1;i<=Count-1;i++)
{
Caption=frmData.FieldToTextFormula[i].text;
Caption='['+Caption+']';
FieldID=frmData.FieldToTextFormula[i].value;
FieldID='[Fld'+FieldID+']';
Desc=replace(Desc,FieldID,Caption);
}
return(Desc);
}
//公式数据的合法性检查(Data Check)
function FormulaDC()
{
if (JTrim(document.frmData.Description.value)=='')
{
alert("公式未填写,请填写。")
return false;
}
if (CheckFormula()==false)
{
alert(FormulaErrDesc)
return false;
}
else
{
alert("检查通过。")
return true;
}
}
function Save()
{
if (JTrim(document.frmData.Description.value)=='')
{
alert("公式未填写,请填写。")
return false;
}
if (CheckFormula()==false)
{
alert(FormulaErrDesc)
return false;
}
var SQLDesc,Divisor
SQLDesc=frmData.SQLDesc.value;
Divisor=frmData.Divisor.value;
window.returnValue = "1,"+SQLDesc+ItemSep+Divisor;
window.close();
}
function Cancel()
{
window.returnValue = "0";
window.close();
}
//-->
</script>
<html>
<head>
<title>设置公式</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" LANGUAGE=javascript onload="return InitFormula()">
<form METHOD="post" name="frmData">
<table width="100%" border=0 align=center CELLSPACING=0 CELLPADDING="0">
<tr height="35">
<td colspan=5>
<b>
设置公式---简单文字拼接
</b>
</td>
</tr>
<tr height=105 valign="top">
<td colspan=5>
<table width="95%" border=0 CELLSPACING="1" CELLPADDING="0">
<tr>
<td bgcolor="#e0e0e0" width="30%">
<p align="left">
插入字段
</p>
</td>
<td bgcolor="white" width="70%">
<p align="left" id=FieldToFormulaSelect>
</p>
</td>
</tr>
<tr>
<td bgcolor="#e0e0e0" width="30%">
<p align="left">
计算公式<FONT color=red>*</FONT>
</p>
</td>
<td bgcolor="white" width="70%">
<p align="left">
<INPUT TYPE="text" style='WIDTH:360px' maxLength=100 NAME="Description" ONSELECT="storeCaret();" onCLICK="storeCaret();" onKEYUP="storeCaret();">
</p>
</td>
</tr>
<tr>
<td bgcolor="#e0e0e0" width="30%">
<p align="left">
公式示例
</p>
</td>
<td bgcolor="white" width="70%">
<p align="left">
<INPUT TYPE="text" style='WIDTH:360px' maxLength=100 disabled NAME="Sample" value='left([产品型号],3)+'-'+[定单日期]'>
</p>
</td>
</tr>
<tr>
<td colspan=2>
<p align=left>说明:利用其它字段拼接出新的文字串,可采用以下函数:left([字段名称],长度),right([字段名称],长度),mid([字段名称],起始位置,长度)。请注意函数名称的大小写,起始位置、长度必须大于0,固定字串请用单引号括起来。</p>
</td>
</tr>
</table>
</td>
</tr>
<tr height=40 valign=bottom>
<td colspan="5">
<table width="100%">
<tr>
<td width="20%"></td>
<td width="20%"><input id="btnDC" type="button" value="检查" name="btnDC" style="cursor:hand; WIDTH: 50px; HEIGHT: 24px" LANGUAGE="javascript" onclick="return FormulaDC();"></td>
<td width="20%"><input id="btnSave" type="button" value="确定" name="btnSave" style="cursor:hand; WIDTH: 50px; HEIGHT: 24px" LANGUAGE="javascript" onclick="return Save()"></td>
<td width="20%"><input id="btnCancel" type="button" value="取消" name="btnCancel" style="cursor:hand; WIDTH: 50px; HEIGHT: 24px" LANGUAGE="javascript" onclick="return Cancel()"></td>
<td width="20%"></td>
</tr>
</table>
</td>
</tr>
</table>
<input TYPE="hidden" NAME="SQLDesc">
<input TYPE="hidden" NAME="Divisor">
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -