VBScript工具方法 服务端脚本
1)CStr(DateAdd("d",1,trim(request("Excel_EndDate"))))
2)cDate(LStr_EndDate)+1
3)document.write(FormatNumber(20000.578,2,,,0))
输出:
20000.58
4)document.write(FormatNumber(20000.578,2))
输出:
20,000.58
'处理返回数据表字段为的null情况
function DBFiledValueIsNull(DBFiledValue)
if(IsNull(DBFiledValue)) then
DBFiledValueIsNull=0
else
DBFiledValueIsNull=DBFiledValue
end if
end function
'处理程序中变量为null,Empty或者定义了未赋值的情况
function IsNullOrEmpty(x)
if((IsEmpty(x)) OR IsNull(x)) then
IsNullOrEmpty=""
else
IsNullOrEmpty=x
end if
end function
'检查数据源【rs:adodb.recordset】中是否包含【列:fieldName】
function IsExistsFieldName(rs,fieldName)
haveField=false
for each item in rs.fields
if UCase(item.name)= UCase(fieldName) then
haveField=true
exit for
end if
next
IsExistsFieldName=haveField
end function
%>
<%
'ASP里面创建GUID
Function GenerateGuid()
Dim TypeLib
LXH_OrgiGuid=""
Set TypeLib = CreateObject("Scriptlet.TypeLib")
LXH_OrgiGuid= Left(TypeLib.Guid,38)
GenerateGuid=LCase(replace(replace(replace(cstr(LXH_OrgiGuid),"-",""),"{",""),"}",""))
End Function
%>
‘━┅━┅━┅━┅━┅━┅━┅━┅━━┅━┅━┅━┅━┅━┅━┅━━┅━┅━┅━┅━┅━┅━┅━┅━━┅━┅━┅━┅━┅━┅━┅━━┅━┅━┅━┅━┅━┅━┅━┅━━┅━┅━┅━┅━┅━┅━┅━━┅━┅━┅━┅━┅━┅━┅━┅━━┅━┅━┅━┅
<%
'使用方法:先使用Server.UrlEncode编码,然后使用URLDecode解码
Function URLDecode(enStr)
dim deStr
dim c,i,v
deStr=""
for i=1 to len(enStr)
c=Mid(enStr,i,1)
if c="%" then
v=eval("&h"+Mid(enStr,i+1,2))
if v<128 then
deStr=deStr&chr(v)
i=i+2
else
if IsValidHex(mid(enstr,i,3)) then
if IsValidHex(mid(enstr,i+3,3)) then
v=eval("&h"+Mid(enStr,i+1,2)+Mid(enStr,i+4,2))
deStr=deStr&chr(v)
i=i+5
else
v=eval("&h"+Mid(enStr,i+1,2)+cstr(hex(asc(Mid(enStr,i+3,1)))))
deStr=deStr&chr(v)
i=i+3
end if
else
destr=destr&c
end if
end if
else
if c="+" then
deStr=deStr&" "
else
deStr=deStr&c
end if
end if
next
URLDecode=deStr
end function
function IsValidHex(str)
IsValidHex=true
str=ucase(str)
if len(str)<>3 then IsValidHex=false:exit function
if left(str,1)<>"%" then IsValidHex=false:exit function
c=mid(str,2,1)
if not (((c>="0") and (c<="9")) or ((c>="A") and (c<="Z"))) then IsValidHex=false:exit function
c=mid(str,3,1)
if not (((c>="0") and (c<="9")) or ((c>="A") and (c<="Z"))) then IsValidHex=false:exit function
end function
%>
‘━┅━┅━┅━┅━┅━┅━┅━┅━━┅━┅━┅━┅━┅━┅━┅━━┅━┅━┅━┅━┅━┅━┅━┅━━┅━┅━┅━┅━┅━┅━┅━━┅━┅━┅━┅━┅━┅━┅━┅━━┅━┅━┅━┅━┅━┅━┅━━┅━┅━┅━┅━┅━┅━┅━┅━━┅━┅━┅━┅
asp参数传递 解决方案:
在asp使用Get方式传送"WebPage.aspx?str="+server.urlEncode( server.URLpathencode(str))
asp.net GET方式传送参数:"WebPage.aspx?str="+ HttpUtility.UrlEncode( str,System.Text.Encoding.GetEncoding("gb2312"))
asp.net GET方式接收参数:str= HttpUtility.UrlDecode(Request.QueryString["str"].ToString().Trim(),System.Text.Encoding.GetEncoding("gb2312"))

浙公网安备 33010602011771号