: 该页面有自动刷新功能,使在线用户可以尽快的看到最新的选举情况。我们这里设定每隔30秒钟自动刷新一次。<meta http-equiv="refresh" content="10;url=show.asp"> 显示投票时,我们采用了while循环,把候选人及其得票数,整齐地显示在一个表格中,这种技术在数据库查询结果的显示中也经常用到。代码如下:<%while not hs.eof %><tr><td width="100%"><center><font color="#8000ff"><big><%=hs("name")&" "&hs("result")&"票"%></big> </font></center></td></tr><%hs.movenext%><%wend%>
查询页面:
教师可查询本人的总得分、各分项得分及所在院(系)的平均分,也可以查看全院老师的整体排名。并可通过数据库的历史记录对以往的得分进行同样的操作。
图5-1 查询流程图
代码如下:
function AddSe(){
var val,val_tmp,Sql,oAdd,TextType;
var Field,Condition,TextVal,Relation;
Field=frm_Search.Field.options[frm_Search.Field.selectedIndex].text;
TextVal="'"+frm_Search.TextVal.value+"'" ; Condition=frm_Search.Condition.options[frm_Search.Condition.selectedIndex].text; Relation=frm_Search.Relation.options[frm_Search.Relation.selectedIndex].text;
val_tmp = frm_Search.Field.value;
val_tmp = val_tmp.substring(0,1);
//判断字段的数据类型,如果为1,就是字符、日期型;为2,就是数值型;
if (val_tmp==1)
{TextType="'"+frm_Search.TextVal.value+"' " ;}
else
{TextType=""+frm_Search.TextVal.value+" " ;}
val_Field = frm_Search.Field.value;
val_Field = val_Field.substr(1);
val= val_Field + frm_Search.Condition.value + TextType + frm_Search.Relation.value ;
Sql = Field+Condition+TextVal+Relation;
oAdd=document.createElement("option")
oAdd.value=val;
oAdd.text=Sql;
frm_Search.seSql.add(oAdd);
}
//把条件查询语句从<select>查询列表框中删除;
function moveSe(){
for (i=1;i<frm_Search.seSql.options.length;i++){
if(frm_Search.seSql.options[i].selected){
frm_Search.seSql.remove(frm_Search.seSql.selectedIndex);
}
}
}
//取得查询条件,并提交;
function getVal(){
var gettxt,Setable;
gettxt = "";
var path = window.location.pathname ; //取得页面链接和文件名
var line = path.lastIndexOf("/"); //取得最后一个'/'的位置
var dot = path.indexOf("."); //取得第一个'.'的位置
var Name = path.substring(line+1,dot); //取得文件名
var fileName = Name + ".asp";
for (i=1;i<frm_Search.seSql.options.length;i++){
gettxt = gettxt+ " " + frm_Search.seSql.options[i].value ;}
var valLeng=gettxt.lastIndexOf(" ");
gettxt=gettxt.substr(0,valLeng); //去掉条件子句的最后一个关系运算符
Setable = frm_Search.Setable.value ;
//window.open (fileName+'?gettxt='+gettxt,'_self'); //向当前页面传送查询条件子句
基于Web的网上评教系统(七)相关范文