js常用(11)

来源:未知 责任编辑:责任编辑 发表时间:2015-01-01 13:16 点击:

Function random(length)
Dim n,str
rnds=""
Randomize
For i=1 To length
n=Int(75*Rnd+48)
If (n>57 and n<65) Or (n>90 and n<97) Then
i=i-1
Else
rnds=rnds&Chr(n)
End If
Next
random=rnds
End Function

'********************************************
'函数功能:对密码进行加密/解密(最大长度为15位)
'********************************************
Function Encrypt(preString)
Dim pwds,s
pwds=""
s=Left(preString,15)
For i=1 To Len(s)
seed=170-Asc(Mid(s,i,1))-i
pwds=pwds & Chr(seed)
Next
Encrypt=pwds
End Function

'********************************************
'函数功能:格式化当前时间字串
'参数:无
'返回值:返回当前时间的纯数字字符串方式的表示(例如:当前时间2001-10-3 2:34:6,返回字符串"20011003023406")
'********************************************
Function TheDate()
y=year(date())
m=month(date())
d=day(date())
h=Hour(time())
n=Minute(time())
s=Second(time())
If Len(m)=1 Then m="0"&m
If Len(d)=1 Then d="0"&d
If Len(h)=1 Then h="0"&h
If Len(n)=1 Then n="0"&n
If Len(s)=1 Then s="0"&s
thedate=y&m&d&h&n&s
End Function

'********************************************
'函数功能:返回字符串的长度
'参数:字符串
'返回值:字符串长度
'********************************************
Function strLen(str)
dim p_len
p_len=0
strlen=0
if trim(str)<>"" then
p_len=len(trim(str))
for xx=1 to p_len
if asc(mid(str,xx,1))<0 then
strlen=int(strlen) + 2
else
strlen=int(strlen) + 1
end if
next
end if
End Function

'********************************************
'函数功能:发送邮件通知
'参数:字符串
'返回值:成功/失败
'********************************************
Function SendMail(ToAddress, Subject, Body)
On Error Resume Next
Set objMail = Server.CreateObject("JMail.Message")
objMail.From = ADR_Email
objMail.FromName = "ADR管理中心"
objMail.Subject = Subject
objMail.AddRecipient ToAddress
objMail.Body = Body
If objMail.Send("") Then
SendMail = True
Else
SendMail = False
End If
If Err.Number<> 0 Then SendMail = False
Set objMail = Nothing
On Error Goto 0
End Function
%>
-----------------------------------------------------------------------------------

//检验法人代码
function isCorporationCode(s){
var patrn=/^(\d){15}$/;
if (!patrn.exec(s)) return false
return true
}

//校验登录名:只能输入5-20个以字母开头、可带数字、“_”、“.”的字串

发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
用户名: 验证码:点击我更换图片
最新评论 更多>>

推荐热点

  • Gb2312转utf-8编码的方法(vbs+js)
  • 如何使用Ajax技术开发Web应用程序(1)
  • js跳转路径问题
  • JavaScript模仿桌面窗口
  • 用js检测两个线段是否相交
  • 运用JavaScript构建你的第一个Metro式应用程序(on Windows
  • 我知道的JavaScript -- 设计模式(桥接)应用之 – 验证器
  • 我是如何去了解jquery的(六),案例之幻灯片轮换
  • Jquery封装幻灯片效果
网站首页 - 友情链接 - 网站地图 - TAG标签 - RSS订阅 - 内容搜索
Copyright © 2008-2015 计算机技术学习交流网. 版权所有

豫ICP备11007008号-1