- 热门文章:
- · ASP的函数详解
- · 一个取图片尺寸的类,支持jpg,gif,png
- · JS错误代码解释大全
- · 窗口最大化的严格定义
- · 一個簡單的驗証碼
- · 17种正则表达式
- · 一个非常简洁的验证码程序
- · 今天做了一个ASP计数器,放出源码吧,挺简单的!
- · 个性化的表单验证效果
- · 利用ASP得到图片尺寸大小
- · 如何处理ASP中的图象
- · 精华asp代码
上一篇:闰年的判别 >>
计算文件下载时间
Function DownloadTime(intFileSize, strModemType)
Dim TimeInSeconds, ModemSpeed, strDownloadTime, AppendString
Dim intYears, intWeeks, intDays
Dim intHours, intMinutes, intSeconds
intYears = 0
intWeeks = 0
intDays = 0
intHours = 0
intMinutes = 0
intSeconds = 0
strDownloadTime = ""
Select Case strModemType
Case "Cable"
ModemSpeed = 400000
Case "56kbps"
ModemSpeed = 7000
Case "33.6kbps"
ModemSpeed = 4200
Case "28.8kbps"
ModemSpeed = 3600
End Select
TimeInSeconds = int(intFileSize / ModemSpeed)
‘’year maths added 1/4 of a day. 1 exact orbit of the sub is 365.25 days.
If (Int(TimeInSeconds / 31471200) <> 0) Then intYears = Int(TimeInSeconds / 31449600)
If ((Int(TimeInSeconds / 604800) Mod 52) <> 0) Then intWeeks = Int(TimeInSeconds / 604800) Mod 52
If ((Int(TimeInSeconds / 86400) Mod 7) <> 0) Then intDays = Int(TimeInSeconds / 86400) Mod 7
If TimeInSeconds >= 3600 Then intHours = Int(TimeInSeconds / 3600) Mod 24
If TimeInSeconds >= 60 Then intMinutes = Int(TimeInSeconds / 60) Mod 60
If TimeInSeconds >= 0 Then intSeconds = Int(TimeInSeconds) Mod 60
If intYears <> 0 Then
If intYears = 1 Then AppendString = "" Else AppendString = "s"
strDownloadTime = strDownloadTime & intYears & " year" & AppendString & ", "
End If
If intWeeks <> 0 Then
If intWeeks = 1 Then AppendString = "" Else AppendString = "s"
strDownloadTime = strDownloadTime & intWeeks & " week" & AppendString & ", "
End If
If intDays <> 0 Then
If intDays = 1 Then AppendString = "" Else AppendString = "s"
strDownloadTime = strDownloadTime & intDays & " day" & AppendString & ", "
End If
If intHours <> 0 Then
If intHours = 1 Then AppendString = "" Else AppendString = "s"
strDownloadTime = strDownloadTime & intHours & " hour" & AppendString & ", "
End If
If intMinutes <> 0 Then
If intMinutes = 1 Then AppendString = "" Else AppendString = "s"
strDownloadTime = strDownloadTime & intMinutes & " minute" & AppendString
End If
If ((intYears = 0) And (intWeeks = 0) And (intDays = 0) And (intHours = 0)) Then
If intSeconds = 1 Then AppendString = "" Else AppendString = "s"
If intMinutes > 0 Then
strDownloadTime = strDownloadTime & ", " & intSeconds & " second" & AppendString
Else
strDownloadTime = strDownloadTime & intSeconds & " second" & AppendString
End If
End If
DownloadTime = strDownloadTime
End Function
%>
<html>
<body>
It is going to take about
<%=DownloadTime(123456,Cable)%> to download this file.
</body>
</html>
下一篇:ASP的函数详解 >>
相关文章:
- · ASP中的函数说明
- · FileCopy
- · 事务处理
- · ASP中得到用户的真实IP地址
- · ASP编程中15个非常有用的例子
- · InStrRev 函数
- · 新写的一个定时新闻小偷
- · 一段自动补位的函数(ASP)
- · VBS 中 Space 函数的应用
- · 游走于ASP与ASP.NET的郁闷
- · 用ASP的安全验证来对windows 2000的管理者密码进行在线修改
- · ADSI,使用ASP来完成NT管理
- · 被ASP的小问题难倒!
- · 域名查询系统--适合新手
- · asp模块化分页
- · ASP分页显示详论
- · Iframe高度自适应
- · 正则表达式大全
- · WMI学习
- · Session 详解
- · 关于交叉报表的动态实现
- · 页面执行需要长时间时向用户的提示信息
- · 使用Repeater模板 二
- · Sucess On a Horse
- · 校友通讯资料管理系统(1)
- · ASP实现图片上存
- · 提高网站在搜索引擎中的排名
- · 关于无组上传的老话题
- · 如何实现图片的随机生成与显示
- · 怎么把webapplication打包成安装文件
- · 为treeview添加客户端事件
- · 如何让不同的语言版本显示正确的中文?
- · 线程的处理(2)
- · 线程的处理(1)
- · 再谈ASP防止SQL Injection漏洞的问题
- · 用asp编写文档搜索页面
- · ASP中使用SQL语句
- · 利用反射动态调用类成员
