首页 > 开发 > 综合 > 正文

VBScript编码规范格式

2024-07-21 02:20:46
字体:
来源:转载
供稿:网友

代码规范:

<!-- metadata
type="typelib"
file="c:/program files/common files/system/ado/msado20.tlb"
-->

<%@ language=vbscript %>
<%option explicit%>

<%
'加入的文件
%>
<!-- #include virtual|file="需要包含的文件" -->

<%
'代码版权说明:
'=========================================================
' file: 文件名.asp
' version:1.0
' date:
' script written by tommy xiao
' description:
'
' revision:
' date:
' author:
' description:
'=========================================================
' copyright (c) 2003 asiagame.com. all rights reserved.
' web: http://www.advancededu.com
' need help? contact: [email protected]
'=========================================================
%>
<%
'容错机制代码
'--------------------------------
dim ndebug_msg
ndebug_msg=false

if ndebug_msg = true then
'出错过滤
on error resume next
end if

'变量声明及定义区
'boolean error variant
dim blnfounderr,serrmsg
blnfounderr = false
'触发错误信息
'serrmsg=serrmsg+"<br>"+"<li>没有找到您需要的信息,欢迎使用。"
'blnfounderr = true

dim oconn,ors,ssql 'ado objects

'set oconn = server.createobject ("adodb.connection")
' oconn.open application("connstr")

'事务定义区



'输出错误
if blnfounderr = true then
merror()
end if

'func,proc定义区
function dealinput(exp1)
dim exp2 'filter input for invalid characters
exp2=replace(exp1,"<","&lt;")
exp2=replace(exp2,">","&gt;")
exp2=replace(exp2,"'","''")
exp2=replace(exp2,"&","&amp;")
dealinput=exp2
end function

function closedatabase ' closedatabase
oconn.close
set oconn = nothing
end function


sub merror()
'response.write serrmsg&"please contact system administrator."
response.write " <html>" & vbcrlf
response.write " <head>" & vbcrlf
response.write " <title>xxx站点--web后台管理</title>" & vbcrlf
response.write " <meta name=""generator"" content=""microsoft visual studio 6.0"">" & vbcrlf
response.write " <link rel=""stylesheet"" type=""text/css"" href=""css/index.css"">" & vbcrlf
response.write " <script type=""text/javascript"" src=""js/fx.js""></script>" & vbcrlf
response.write " <script type=""text/javascript"" src=""js/cooltool.js""></script>" & vbcrlf
response.write "" & vbcrlf
response.write " </head>" & vbcrlf
response.write "" & vbcrlf
response.write " <body>" & vbcrlf
response.write " <table cellpadding=""0"" cellspacing=""0"" border=""0"" width=""95%"" bgcolor=""#777777"" align=""center"">" & vbcrlf
response.write " <tr>" & vbcrlf
response.write " <td>" & vbcrlf
response.write " <table cellpadding=""3"" cellspacing=""1"" border=""0"" width=""100%"">" & vbcrlf
response.write " <tr align=""center""> " & vbcrlf
response.write " <td width=""100%"" bgcolor=""#eeeeee"">内部管理操作错误信息</td>" & vbcrlf
response.write " </tr>" & vbcrlf
response.write " <tr> " & vbcrlf
response.write " <td width=""100%"" bgcolor=""#ffffff""><b>产生错误的可能原因:</b><br><br>" & vbcrlf
response.write " <li>请您尽快与管理员联系,获得相应地的帮助。</a>" & vbcrlf
response.write serrmsg & vbcrlf
response.write " </td>" & vbcrlf
response.write " </tr>" & vbcrlf
response.write " <tr align=""center""> " & vbcrlf
response.write " <td width=""100%"" bgcolor=""#eeeeee"">" & vbcrlf
response.write " <a href=""javascript:history.go(-1)""> << 返回上一页</a>" & vbcrlf
response.write " </td>" & vbcrlf
response.write " </tr> " & vbcrlf
response.write " </table> </td></tr></table>" & vbcrlf
response.write " </body>" & vbcrlf
response.write " </html>"
end sub
%>


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表