扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:何 凯 来源:yesky 2007年11月8日
关键字: Windows
<script language="VBScript"> <!-- 'Written by HeKai 2001 Function datacheck()'确保前台输入数据合法 dim errflag, msg errflag = True if Len(Trim(luru.xzsj.value)) = 0 Then focusto(1); errflag = false; msg="请输入 '选自书籍名称'" ElseIf Len(Trim(luru.stnr.value)) = 0 Then focusto(9); errflag = false; msg=" '试题内容' 呢" ElseIf Len(Trim(luru.A.value)) = 0 Then focusto(10); errflag = false; msg=" '答案_A' 呢" ┋ ┋ ┋ ElseIf Len(Trim(luru.F.value)) = 0 Then focusto(15); errflag = false; msg="请还原成默认值" End if If (errflag = false) then msg = msg & vbCRLF MsgBox msg, 64, "提示" Exit Function End if datacheck = errflag; luru.Submit End Function Sub focusto(x)'将鼠标定位在出错处 document.luru.elements(x).focus() End Sub --></script> |
<script Language="VBScript" RunAt="Server"> Function check_Pass()'检查库中是否已有此数据 kmxxmc = Request.Form("kmxxmc") stbh = Request.Form("stbh") stnr = Request.Form("stnr") SQLstr = "select * from " & kmxxmc & " where stbh=" & "'" & stbh & "'" SQLstr = SQLstr & " or tmnr=" & "'" & stnr & "'" set adocon=Server.CreateObject("ADODB.Connection") adocon.Open "zxtest" set sa1=adocon.Execute(SQLstr) If sa1.EOF Then check_Pass = False Else check_Pass = True End If sa1.Close adocon.Close End Function Sub Add_Comment()'开始插入数据并显示出来 Dim kmxxmc,xzsj,tmlx,nycd,jxyq,stbh,stnr Dim A,B,C,D,E,F,bzda,lrz,Picstr,SQLstr,lr_date,zhang,jie kmxxmc = Request.Form("kmxxmc") xzsj = Request.Form("xzsj") ┋ ┋ ┋ bzda = Request.Form("bzda") zhang = Request.form("zhang") set adocon=Server.CreateObject("ADODB.Connection") adocon.Open "zxtest" SQLstr = "insert into " & kmxxmc & " (xzsj,tmlx,tmnd,jxyq,stbh,tmnr, bxda_a," SQLstr = SQLstr & ",jie,lrz) values (" & "'" & xzsj & "'," & "'" & tmlx & "'," ┋ ┋ ┋ SQLstr = SQLstr & "'," & "'" & date & "'," & "'" & zhang & "'," & "'" & jie & "'," SQLstr = SQLstr & "'" & lrz & "')" set sa1 = adocon.Execute(SQLstr) Picstr="<img src='/images/hekai.jpg'>" Response.Write "恭喜!此为<i> " & lrz & "</i> 刚才录入的试题" Response.Write Picstr & " 试题编号:" & stbh Response.Write "试题内容:" & stnr & "<br>" Response.Write "答案_A:" & A & "<br>" ┋ ┋ ┋ adocon.Close End Sub Sub Register() If check_Pass() Then '如果库中已有的话,则给出提示信息 Show_Warning() Else '否则添加进去 Add_Comment() End If End Sub Sub Show_Warning()'给出提示信息的函数 Response.Write("<p>") Response.Write("<center>很抱歉<p>") Response.Write("库中已有此试题编号或试题内容,请返回前页修改!") Response.Write("</center>") Response.Write("Made by hekai himself in 2001") End Sub </script> 此为"检索试题"的程序代码: <script Language="VBScript" RunAt="Server"> Function adjust_sql(adj_str) '目的---转换查询字符串中的特殊字符至SQL指令 Dim final_str, i 'WRITE BY HEKAI2001 adj_str = Trim(adj_str) final_str = "" '每次从传进来的字符串中取出一个字符,并判断是否为下述三个字符之一: DOS的Filter符号"|"、左中括号"["以及单引号"'" If Len(adj_str) > 0 Then For i = 1 To Len(adj_str) Select Case Mid(adj_str, i, 1) Case "[": final_str = final_str & "[[]" Case "|": final_str = final_str & "[{-}]" Case "'": final_str = final_str & "[&-()" Case Else: '以上皆非则什么事都不做! final_str = final_str & Mid(adj_str, i, 1) End Select Next End If adjust_sql = final_str End Function Sub Output_shiti() Dim kmxxmc,xzsj,stbh,zhang,jie,tmlx,nycd,jxyq,lrz,stnr,cond_count, Picstr Dim SQLstr,mf,zhangfw,jiefw,stbhfw,nycdfw,lr_datefw,lr_date '记录指定条件的栏位总数 cond_count = 10; mf = "%" Picstr="<img src='/images/hk.gif'>" '取得表单栏位内容 kmxxmc = Request.Form("kmxxmc") stbh = Request.Form("stbh") ┋ ┋ ┋ stnr = Request.Form("stnr") '调整SQL指令中的特定字元 kmxxmc = adjust_sql(kmxxmc) stbh = adjust_sql(stbh) ┋ ┋ ┋ stnr = adjust_sql(stnr) If Len(xzsj) = 0 Then cond_count = cond_count - 1 If Len(stbh) = 0 Then cond_count = cond_count - 1 ┋ ┋ ┋ If Len(stnr) = 0 Then cond_count = cond_count - 1 SQLstr = "select * from " & kmxxmc & " where " If Len(stbh) > 0 Then SQLstr = SQLstr & " stbh " & stbhfw & "'" & stbh & "'" If cond_count > 1 Then SQLstr = SQLstr & " and " cond_count = cond_count - 1 End If End If ┋ ┋ ┋ If Len(stnr) > 0 Then SQLstr = SQLstr & " tmnr like " & "'" & mf & stnr & mf & "'" If cond_count > 1 Then SQLstr = SQLstr & " and " cond_count = cond_count - 1 End If End If SQLstr = SQLstr & " order by lr_date DESC " set adocon=Server.CreateObject("ADODB.Connection") adocon.Open "zxtest" set sa1 = adocon.Execute(SQLstr) If sa1.EOF Then Response.Write "<br><center><h1>" Response.Write "Sorry!<p>" Response.Write "没有找到试题," esponse.Write "请重试一次!</center><p>" Response.Write "<hr></h1>" Else i = 0 Response.Write "<h2>" Response.Write "符合条件的试题相关内容如下:" Response.Write "</h2>" While Not sa1.EOF i = i + 1 Response.Write "第 <i>" & i & "</i>题 题编号:<i>" & sa1("stbh") & "</i><br>" Response.Write "试题内容:" & sa1("tmnr") & "<br>" ┋ ┋ ┋ Response.Write "答案A:" & sa1("bxda_a") & "<br>" sa1.MoveNext WEnd adocon.Close End If End Sub </script> <% '"检索试卷"的查询方式源代码 mf="%" select case request("findfs") case "sjbh" sqlstr="SELECT * FROM tbsjxx WHERE " & " sjbh LIKE" sqlstr=sqlstr & "'" & mf & request("findfsz") & mf & "'order by ksrq DESC" ┋ ┋ ┋ case "lr_date" sqlstr="SELECT * FROM tbsjxx WHERE " & " lr_date LIKE" sqlstr=sqlstr & "'" & mf & request("findfsz") & mf & "'order by ksrq DESC" case else sqlstr="SELECT * FROM tbsjxx order by ksrq DESC" end select %> |
<SCRIPT language=JavaScript> <!-- Write by HEKAI for TestTimeContorl var timerID = null;var timerRunning = false var stardate = new Date();var startime = gettotalsecond(stardate) var totaltime = 60; var lasttime;var facetime function Stepclock(){ // hk made by himself if(timerRunning) clearTimeout(timerID) timerRunning = false } function startclock(){ Stepclock();showtime() } function gettotalsecond(getdate){ var hours = getdate.getHours() var minutes = getdate.getMinutes();var seconds = getdate.getSeconds() var gettotalsecond = seconds + minutes * 60 + hours * 3600 return(gettotalsecond) } function showtime(){ var now = new Date();var timeValue = gettotalsecond(now) document.clock.face.value = timeValue - startime facetime = document.clock.face.value;lasttime = totaltime - facetime document.clock.sytime.value = lasttime timerID = setTimeout("showtime()",1000) timerRunning = true if (lasttime == 20){ for(i=1;i<=3;i++){ alert('考试时间只剩下最后20秒!')}} if (lasttime == 0){ for(i=1;i<=5;i++){ alert('时间完毕!请迅速交卷!!')}} if (lasttime == -10){ for(i=1;i<=10;i++){ alert('考试时间超过10秒,关闭此窗口!')}} }//--> </SCRIPT> |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者