- 热门文章:
- · asp开发规范
- · ASP六大对象介绍(绝对详细)
- · 用asp整理磁盘文件
- · HTTP 500 内部服务器错误修正办法
- · 一份ASP学习笔记(连载三)
- · 动态生成的3级联动<select>
- · 一份ASP学习笔记(连载二)
- · 用字典提取汉语的拼音的首字母
- · IIS6.0的设置
- · 一份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开发规范 >>
相关文章:
- · IIS中的MIME格式
- · Background属性简介
- · MSWC.NextLink的使用方法
- · ping的高级用法
- · 查询一条记录,按所选择的字段输出。
- · 多文件多文本框上传程序
- · 用asp整理磁盘文件
- · 将ACCESS转化成SQL2000需要注意的几个问题
- · 项目中的模块
- · 将人民币的数字表示转化成大写表示
- · ASP中存储过程调用的两种方式,以及不采用存储过程的方式比较
- · 关于ASP的(VBScript)类,只希望给初学者看一看,希望对你们有帮助
- · 认识ASP内置的对象
- · ASP内置对象
- · ASP函数
- · 随机生成不重复记录的伪函数
- · 浅谈随机得控制
- · 一个关于日期选择的很实用的小东西
- · ASP的身份证验证代码改进
- · DHTML对象模型(About the DHTML Object Model)(三)
- · DHTML对象模型(About the DHTML Object Model)(二)
- · DHTML对象模型(About the DHTML Object Model)(一)
- · 全面考察“禁用浏览器后退按钮”
- · 如何快速找到ASP的错误
- · 中国高校勤工助学网站程序开发质量和管理标准化
- · asp上传
- · Form提交打开固定大小窗口的解决办法
- · 按钮链接乾坤大挪移
- · DW+ASP 玩转动态二级菜单
- · WEB环境中后台自动上传文件至数据库的实现
- · VBScript 函数集
- · 如何在生成的静态页面中显示文章被阅读的次数
- · 查看服务器所有Application变量、Session变量工具
- · 创建一个ASP通用分页类(二)代码部分
- · 创建一个ASP分页类(一)文章部分
- · 错误80004005信息处理方法
- · urldecode 方法补遗。
- · 建立你网站的投票机制![翻译]
