⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 functions.asp

📁 网络教学平台由教师教学系统、学生学习系统和教学管理系统三大模块组成
💻 ASP
字号:
<%
'*************************************************
'函数名:GetMulResult(a,b,c)
'作  用:算出选题分数!
'参  数:a   ----正确答案
'       b   ----考生所选答案
'		c	 ----此题分数
'返回值:最后分数
'*************************************************
Function GetScore(a,b,c)'//Writed by lengcool@hotmail.com at 2003-4-25
	
	scorex=0
	a=Ucase(a)
	b=Ucase(b)
	c=Ucase(c)'都用大写,这样不会出错
	If InStr(a,b)<>0 Then'可能选对或少选
		x=Ubound(Split(b,","))+1'所选答案个数
		y=Ubound(Split(a,","))+1'正确答案个数
		scorex=Int((c/y)*x)
	End If
	GetScore=scorex

End Function

'*************************************************
'函数名:MyRnd(X,Y)
'作  用:取出指定范围内不重复的数字!
'参  数:X   ----共有多少记录
'       Y   ----取出多少记录
'返回值:字符串
'*************************************************
Function MyRnd(X,Y)'//Writed by lengcool@hotmail.com at 2003-4-28,Edit At 2003-5-19
	Dim K,P,TP,I,T
	For K=0 To 100
		Randomize
		P=Fix(Rnd*X)+1
		If Not Instr(TP,P)>0 Then
			TP=TP & P & ","
			I=I+1
		end If
		If I>=Y Then Exit For
	Next
	T=Split(TP,",")
	MyRnd=Join(T,",")
End Function

'*************************************************
'函数名:YesOrNo(iScore,iTop)
'作  用:判断对错!
'参  数:iScore   ----共有多少记录
'       iTop     ----取出多少记录
'返回值:字符串
'*************************************************
Function YesOrNo(iScore,iTop)'//Writed by QQ:190988779 at 2003-11-20

	If Int(iScore)=Int(iTop) Then '全对了,不错!
		iStyle="<font color=#FDA4AC><b>√</b></font>"
	ElseIf Int(iScore)<Int(iTop) And Int(iScore)<>0 Then
		iStyle="<font color=#CC0000 face=Symbol size=4><b>&sup1;</b></font>"
	Else
		iStyle="<font color=red><b>×</b></font>"
	End If
	YesOrNo=iStyle

End Function

'*************************************************
'函数名:DelFile(File)
'作  用:删除文件!
'参  数:File   ----文件真实路径
'返回值:无
'*************************************************
Function DelFile(File)
	on error resume next
	set fso=server.createobject("scripting.filesystemobject")
	fso.DeleteFile server.mappath(SoftPath&File)
	Set fso=Nothing
End Function

'*************************************************
'函数名:LastNextPage(pagecount,page,table_style,font_style)
'作  用:分页通用函数
'参  数:iCount,pagecount,page,table_style,font_style
'返回值:字符串
'*************************************************
Sub PageControl(iCount,pagecount,page,table_style,font_style)
'生成上一页下一页链接
    Dim query, a, x, temp
    action = "http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("SCRIPT_NAME")

    query = Split(Request.ServerVariables("QUERY_STRING"), "&")
    For Each x In query
        a = Split(x, "=")
        If StrComp(a(0), "page", vbTextCompare) <> 0 Then
            temp = temp & a(0) & "=" & a(1) & "&"
        End If
    Next

    Response.Write("<table " & Table_style & ">" & vbCrLf )        
    Response.Write("<form method=get onsubmit=""document.location = '" & action & "?" & temp & "Page='+ this.page.value;return false;""><TR>" & vbCrLf )
    Response.Write("<TD align=right>" & vbCrLf )
    Response.Write(font_style & vbCrLf )    
        
    if page<=1 then
        Response.Write ("首页 " & vbCrLf)        
        Response.Write ("上页 " & vbCrLf)
    else        
        Response.Write("<A HREF=" & action & "?" & temp & "Page=1>首页</A> " & vbCrLf)
        Response.Write("<A HREF=" & action & "?" & temp & "Page=" & (Page-1) & ">上页</A> " & vbCrLf)
    end if

    if page>=pagecount then
        Response.Write ("下页 " & vbCrLf)
        Response.Write ("尾页" & vbCrLf)            
    else
        Response.Write("<A HREF=" & action & "?" & temp & "Page=" & (Page+1) & ">下页</A> " & vbCrLf)
        Response.Write("<A HREF=" & action & "?" & temp & "Page=" & pagecount & ">尾页</A>" & vbCrLf)            
    end if
        
    Response.Write(" 第" & "<INPUT TYEP=TEXT NAME=page SIZE=1 Maxlength=5 VALUE=" & page & ">" & "页"  & vbCrLf & "<INPUT type=submit style=""font-size: 9pt"" value=GO class=b2>")
    Response.Write(" 共 " & pageCount & " 页" &  vbCrLf)            
    Response.Write("</TD>" & vbCrLf )                
    Response.Write("</TR></form>" & vbCrLf )        
    Response.Write("</table>" & vbCrLf )        
End Sub

%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -