📄 html.asp
字号:
<!--#include file="../fcDatabase/Database.asp"-->
<%
/*=========================================================================================
* html类标签
=========================================================================================*/
/*
* 业务代码选择标签提供将数据库表中的字段以selectOptions方式给用户选择
* 参数: database-数据库对象, tableName-表名, valueFieldName-值字段名,
* labelFieldName-显示字段名, filterCondtion-筛选条件, initValue-初始值,用于缺省选择项
*/
function HTML_OPTIONS(database, tableName, valueFieldName, labelFieldName, filterCondtion, initValue) {
var db = database;
var strSQL = "select " + valueFieldName + ", " + labelFieldName + " from " + tableName + " where " + filterCondtion;
var rs = db.runQuerySql(strSQL);
var htmlOptions = "";
while(!rs.EOF) {
var id = rs(valueFieldName) + "";
var name = rs(labelFieldName) + "";
if(id==initValue)
htmlOptions += "<option value=\"" + id + "\" selected>" + name + "</option>";
else
htmlOptions += "<option value=\"" + id + "\">" + name + "</option>";
rs.MoveNext();
}
Response.Write(htmlOptions);
rs.close();
rs = null;
}
/*
* 业务代码翻译标签,提供将业务代码翻译成中文描述的标签
* 参数: database-数据库对象, tableName-表名, codeFieldName-代码字段名,
* labelFieldName-显示字段名, codeFieldName-代码值
*/
function HTML_WRITE(database, tableName, codeFieldName, labelFieldName, codeValue) {
var db = database;
var strSQL = "select " + labelFieldName + " from " + tableName + " where " + codeFieldName + "='" + codeValue + "' ";
var rs = db.runQuerySql(strSQL);
if(!rs.EOF) {
Response.Write(rs(labelFieldName) + "");
}
else {
if(codeValue==null || codeValue=="null")
Response.Write("");
else
Response.Write(codeValue + "");
}
rs.close();
rs = null;
}
/*
* 得到字段值
* 参数: database-数据库对象, tableName-表名, fieldName-代码字段名,
* sqlWhere-sql条件
*/
function HTML_GetFieldValue(database, tableName, fieldName, sqlWhere) {
var db = database;
var strSQL = "select " + fieldName + " from " + tableName + " where " + sqlWhere;
var rs = db.runQuerySql(strSQL);
var returnVal = "";
if(!rs.EOF) {
returnVal = rs(fieldName) + "";
}
else {
if(codeValue==null || codeValue=="null")
returnVal = "";
else
returnVal = codeValue + "";
}
rs.close();
rs = null;
return returnVal;
}
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -