域名申请 虚拟主机 电子商务 搜索引擎排名 网络推广 信康网络
域名注册,企业邮局,虚拟主机
新闻中心 | 用户注册 | 用户中心 | 商务快车 | 电商文章 | 建站资料 | 智能建站 | 中小企业呼叫中心 
企业邮局 虚拟主机 域名注册 虚拟主机 网上商店 企业邮局 网站制作 网站推广 自助建站
 |  建站资料>>ASP技术>>页面不刷新不提交来翻页

  打印

页面不刷新不提交来翻页

http://www.sinocom.net  2003-8-18  信康网络


<%@ Language=VBScript %>
<%Option Explicit%>
<!--#include file="./Public/Function/PublicFunction.asp"-->
<!--#include file="./public/function/opendatabase.asp"-->
<%
Dim intTypeId,strExeName,strTypeName,strStuId,strStuName,strSltSbj,intSbjCode,intCode
Dim strgotopaper,toPaper
On Error Resume Next
intCode=0
'strgotopaper=Request.Form("gotopaper")

'If strgotopaper="ok" Then
' intCode=Cint(Request.Form("toPaper"))
'Else
intCode=Cint(Request.QueryString("intCode"))
'End If
intTypeId=Trim(Request("intTypeId"))
strExeName=Trim(Request("strExeName"))
strTypeName=Trim(Request("strTypeName"))
strStuId=getCookie("strStuId")
strStuName=getCookie("strStuName")
strSltSbj=getCookie("strSltSbj")
intSbjCode=getCookie("intSbjCode")

Dim strRsSql
'************更改考试进展(tongxin和科目表)*****************
strRsSql="Update tongxin Set stdteststep='" & strTypeName & "'"
strRsSql=strRsSql & " Where student_ID='" & strStuId & "'"
strRsSql=strRsSql & " And studentName='" & strStuName & "'"
Conn.Execute(strRsSql)
strRsSql="Update " & strSltSbj & " Set stdteststep='" & strTypeName & "'"
strRsSql=strRsSql & " Where student_ID='" & strStuId & "'"
strRsSql=strRsSql & " And studentName='" & strStuName & "'"
Conn.Execute(strRsSql)

Call CheckError("填空题模块")

%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<link rel="stylesheet" href="./Public/CSS/Wyweb.css">
<SCRIPT Language="JavaScript" Src="./Public/Script/PublicFunction.js"></SCRIPT>
<SCRIPT Language="JavaScript" Src="./Public/Script/PublicVariable.js"></SCRIPT>
<SCRIPT Language="JavaScript" Src="./Public/Script/AnswerQuestion.js"></SCRIPT>
<SCRIPT language="JavaScript" src="./public/script/Forbid.js"></SCRIPT>
<SCRIPT language="JavaScript" src="./public/script/Timer.js"></SCRIPT>
<style type="text/css">
<!--
.title { font-family: "楷体_GB2312", "隶书", "仿宋_GB2312", "Arial"; color: #666600}
BODY {SCROLLBAR-FACE-COLOR: #a7FdfF; SCROLLBAR- HIGHLIGHT-COLOR: #d7fdff; SCROLLBAR-ARROW-COLOR: #ffffe0;SCROLLBAR-SHADOW-COLOR: #ffffe0; SCROLLBAR -BASE-COLOR:#ffffe0;}
table{font:12}
TABLE { FONT: 9pt "宋体"; COLOR: #000000}
TD {FONT: 9pt "宋体"; COLOR: #000000}
.INPUT {
BORDER-RIGHT: #E4FEE4 0px solid; PADDING-RIGHT: 0px; BORDER-TOP: #E4FEE4 0px solid; PADDING-LEFT: 0px; FONT-SIZE: 9pt; BACKGROUND: ; PADDING-BOTTOM: 1px; BORDER-LEFT: #E4FEE4 0px solid; CURSOR: text; COLOR: #000000; PADDING-TOP: 1px; BORDER-BOTTOM: #357000 1px solid; FONT-FAMILY: "Arial"; HEIGHT: 18px;width=180px
}
.TR{
BORDER-RIGHT: 0px solid #E4FEE4; PADDING-RIGHT: 1px; BORDER-TOP: 0px solid #E4FEE4; PADDING-LEFT: 1px; FONT-SIZE: 9pt; BACKGROUND: ; PADDING-BOTTOM: 0px; BORDER-LEFT: 1px solid #E4FEE4; CURSOR: text; COLOR: #000000; PADDING-TOP: 0px; BORDER-BOTTOM: 0px solid #357000; FONT-FAMILY: "Arial"
}
}

-->
</style>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
//定义本页变量
try{
var intFill; //有多少个空要填
var strRsSql;
var intRsNumber; //有多少条记录
var intNumber;
var strRsFillSql;
var intCode=parseInt("<%=intCode%>"); //当前第几个填空题
var intTypeId=parseInt("<%=intTypeId%>");
var strExeName="<%=strExeName%>".toLowerCase();
var strTypeName="<%=strTypeName%>";
var strStuId=getCookie("strStuId");
var strStuName=getCookie("strStuName");
var intSbjCode=getCookie("intSbjCode");
var strDBPath=getCookie("strBakPath") + "\\" + strStuId +"#" + intSbjCode;
var strDBPbasePath=strDBPath + "\\pbase.mdb";
var strDBAnalysisPath=strDBPath + "\\Analysis.mdb";
document.title=document.title + "-" ;
//showLoading(strTypeName,"exam");
//alert("当前第" +intCode + "题");
}catch(e){
blnError=true;
strErrorInfo="错误描述:" +e.description + "|错误出处:【" + strTypeName + "模块】[初始化变量]";
alert(strErrorInfo.replace("|","\n"));
}

function window_onload() {
if(!blnError){
try{
showRichTextBox("idRichTextBoxTitle","ID_TitleArea");
//alert("a");
showTitle();
//openTimeDialog(); //打开计时窗口
disableIEBtn(document.title,"close"); //屏蔽窗口的关闭按钮[X]
winMax(); //最大化窗口
window.focus();
}catch(e){
blnError=true;
strErrorInfo="错误描述:" + e.description + "|错误出处:【" + strTypeName + "模块】[window_onload]";
alert(strErrorInfo.replace("|","\n"));
}
}else{
blnError=true;
alert(strErrorInfo.replace("|","\n"));
}
}

function showTitle(){
try{
Rs.MoveFirst();
Rs.Move(intCode-1);
var strTitle=new String(Rs("M_Title"));
if(strTitle.slice(0,5)=="{\\rtf"){ //如果为True则表示题目的格式是RTF格式的
document.getElementById("idRichTextBoxTitle").TextRTF=strTitle;
}else{ //否则为文本格式
document.getElementById("idRichTextBoxTitle").Text=strTitle;

}
document.getElementById("currentCode").innerHTML="当前第" + intCode + "题";
if(intCode>1){
document.getElementById("moveFirst").innerHTML="<a href='#' onclick='moveFirst()'>第一题";
document.getElementById("movePrevious").innerHTML="<a href='#' onclick='movePrevious()'>上一题";
document.getElementById("movePrevious1").innerHTML="<a href='#' onclick='movePrevious()'>上一题";
}else{
document.getElementById("moveFirst").innerText="第一题";
document.getElementById("movePrevious").innerText="上一题";
document.getElementById("movePrevious1").innerText="";
}
if(intCode<intRsNumber){
document.getElementById("moveNext").innerHTML="<a href='#' onclick='moveNext()'>下一题";
document.getElementById("moveLast").innerHTML="<a href='#' onclick='moveLast()'>最后一题";
document.getElementById("moveNext1").innerHTML="<a href='#' onclick='moveNext()'>下一题";
}else{
document.getElementById("moveNext").innerText="下一题";
document.getElementById("moveLast").innerText="最后一题";
document.getElementById("moveNext1").innerText="";
}

intNumber=parseInt(Rs("I_QuestionNo"));
showChoose();
}catch(e){
blnError=true
strErrorInfo="错误描述:" + e.description + "|错误出处:【答题模块函数】[showTitle]"
alert(strErrorInfo.replace("|","\n"))
}
}

function showChoose(){
try{
var ConnFill=new openConn(strDBAnalysisPath);
strRsFillSql="Select * From tbl_AnalysisPaper"
strRsFillSql=strRsFillSql + " Where I_TypeID=" + intTypeId
strRsFillSql=strRsFillSql+ " And I_QuestionNo=" + intNumber
RsFill.Open(strRsFillSql,ConnFill,1,1);
var intRs=parseInt(RsFill.RecordCount);
if(!(intRs>0))
throw setErrorObj("数据库中没有符合条件记录");
else{
var strAnswer=new String(RsFill("M_StudentAnswer"));
var strArray=changeList(strAnswer);
var strTemp=new String(RsFill("M_TopicAns"));
intFill=strTemp.split("@").length; //得到有多少个空要填
var strTemp1="";
for(var i=1;i<=intFill;i++)
if(strArray[i-1]==null){
strTemp1=strTemp1 + "<TR><TD width=20% align=middle valign=center>第"+i+"空</TD><TD colspan=7><Input class=input Type=text onkeypress='onKeyPress()' name="+i+"></Td></TR>";
}else{
strTemp1=strTemp1 + "<TR><TD width=20% align=middle valign=center>第"+i+"空</TD><TD colspan=7><Input class=input Type=text onkeypress='onKeyPress()' name="+i+" value=" + strArray[i-1] + "></Td></TR>";
}
document.getElementById("show11").innerHTML="<table>" + strTemp1 + "</table>";
}
RsFill.Close();
ConnFill.Close();
ConnFill="";
}catch(e){
blnError=true
strErrorInfo="错误描述:" + e.description + "|错误出处:【答题模块函数】[showChoose]"
alert(strErrorInfo.replace("|","\n"))
}
}

//函数:saveFill
//功能:保存
//说明:每次单击下一题,上一题,每一题,最后一题;或退出此页面时就将这一题所做的进行保存.
function saveFill(){
try{
var strTotalAnswer="";
var SaveConnFill=new openConn(strDBAnalysisPath);
for(var j=1;j<=intFill;j++){
strTemp=document.getElementById(j).value;
//re = /@/g;
strTemp=strTemp.replace(/\\/g,"\\\\");
strTemp=strTemp.replace(/@/g,"\\@");
//var jk=String.fromCharCode(1);
//strTemp=strTemp.replace(re,jk);
if(j==intFill)
strTotalAnswer=strTotalAnswer + strTemp;
else
strTotalAnswer=strTotalAnswer + strTemp + "@";
}
if(strTotalAnswer.charAt(strTotalAnswer.length-1)=="@");

strRsFillSql="Update tbl_AnalysisPaper Set M_StudentAnswer='" +strTotalAnswer +"'"
strRsFillSql=strRsFillSql + " Where I_TypeID=" + intTypeId
strRsFillSql=strRsFillSql + " And I_QuestionNo=" +intNumber
SaveConnFill.Execute(strRsFillSql)
SaveConnFill.Close();
SaveConnFill="";
}catch(e){
blnError=true;
strErrorInfo="错误描述:" + e.description + "|错误出处:【" + strTypeName + "模块】[保存]";
alert(strErrorInfo.replace("|","\n"));
}
}
/*
function gotoOnsubmit(){
saveFill();
//intCode=document.form1.toPaper.value;
//location.reload();
document.form1.submit();
}
*/

//函数:changeList
//功能:转换
//说明:经过转换后再进行显示
function changeList(strDB){
try{
var arrDB=new Array();
strDB=new String(strDB);
var re=new RegExp(String.fromCharCode(1),"g");
var re1=new RegExp(String.fromCharCode(2),"g");
strDB=strDB.replace(/\\\\/g,String.fromCharCode(1));
strDB=strDB.replace(/\\@/g,String.fromCharCode(2));
arrDB=strDB.split("@");
for(var i=0;i<arrDB.length;i++){
arrDB[i]=arrDB[i].replace(re,"\\");
arrDB[i]=arrDB[i].replace(re1,"@");
}
return arrDB;
}catch(e){
blnError=true;
strErrorInfo="错误描述:" + e.description + "|错误出处:【" + strTypeName + "模块】[changeList]";
alert(strErrorInfo.replace("|","\n"));
}
}

function onKeyPress(){
if(event.keyCode==8){
alert("as");
event.returnValue=true;
}
}

function goback(){
saveFill();
window.histroy.back();
}

function window_onunload() {
saveFill();
}

function moveFirst(){
try{
saveFill();
if(parseInt(intCode)!=1){
intCode=1;
showTitle();
}
}catch(e){
blnError=true
strErrorInfo="错误描述:" + e.description + "|错误出处:【答题模块函数】[moveFirst]"
alert(strErrorInfo.replace("|","\n"))
}
}

function movePrevious(){
try{
saveFill();
if(parseInt(intCode)>1){
intCode=intCode-1;
showTitle();
}
}catch(e){
blnError=true
strErrorInfo="错误描述:" + e.description + "|错误出处:【答题模块函数】[movePrevious]"
alert(strErrorInfo.replace("|","\n"))
}
}

function moveNext(){
try{
saveFill();
if(parseInt(intCode)<parseInt(intRsNumber)){
intCode=intCode+1;
showTitle();
}
}catch(e){
blnError=true
strErrorInfo="错误描述:" + e.description + "|错误出处:【答题模块函数】[moveNext]"
alert(strErrorInfo.replace("|","\n"))
}
}

function moveLast(){
try{
saveFill();
if(parseInt(intCode)!=parseInt(intRsNumber)){
intCode=intRsNumber;
showTitle();
}
}catch(e){
blnError=true
strErrorInfo="错误描述:" + e.description + "|错误出处:【答题模块函数】[moveLast]"
alert(strErrorInfo.replace("|","\n"))
}
}

function movego(v){
try{
saveFill();
if(parseInt(v)>0 && parseInt(v)<=intRsNumber){
intCode=parseInt(v);
showTitle();
}
}catch(e){
blnError=true
strErrorInfo="错误描述:" + e.description + "|错误出处:【答题模块函数】[movego]"
alert(strErrorInfo.replace("|","\n"))
}
}
//-->
</Script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></HEAD>
<BODY background="IMAGES/backImage.jpg" topmargin="50" marginheight="50" LANGUAGE=javascript onload="return window_onload()">
<Form Name="form1" action="Fill_YN.asp" method="post">
<TABLE WIDTH=100% height="100%" BORDER=1 align="center" CELLPADDING=0 CELLSPACING=0>
<TR><TD align="center" valign="middle">
<TABLE WIDTH=80% BORDER=1 align="center" CELLPADDING=1 CELLSPACING=0 style="border-collapse: collapse" >
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
try{
var Conn=new openConn(strDBPbasePath);
var Rs=new ActiveXObject("Adodb.Recordset");
var RsFill=new ActiveXObject("Adodb.Recordset");
strRsSql="Select * From tbl_Title Where I_TypeID=" + intTypeId;
Rs.Open(strRsSql,Conn,1,1);
intRsNumber=parseInt(Rs.RecordCount);
intCode=1;
intNumber=Rs("I_QuestionNo");
if(!(intRsNumber>0))
throw setErrorObj("数据库中没有符合条件记录");
}catch(e){
blnError=true;
strErrorInfo="错误描述:" + e.description + "|错误出处:【" + strTypeName + "模块】[得到题目]";
alert(strErrorInfo.replace("|","\n"));
}
//-->
</Script>
<TR>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
try{
document.write("<TD align=middle valign=center >" + strTypeName + "</TD>");
document.write("<TD align=middle valign=center >共" + intRsNumber + "题</TD>");
document.write("<TD align=middle valign=center ><div id='currentCode'></div></TD>");
document.write("<TD align=middle valign=center><div id='moveFirst'></div></TD>");
document.write("<TD align=middle valign=center><div id='movePrevious'></div></TD>");
document.write("<TD align=middle valign=center><div id='moveNext'></div></TD>");
document.write("<TD align=middle valign=center><div id='moveLast'></div></TD>");
document.write("<TD align=middle valign=center ><a href='#' onclick='goback()'>返回</TD>");
}catch(e){
blnError=true;
strErrorInfo="错误描述:" + e.description + "|错误出处:【" + strTypeName + "模块】[显示标题]";
alert(strErrorInfo.replace("|","\n"));
}
//-->
</Script>
</TR>
<TR>
<TD colspan=8 Height=250 ><div id="ID_TitleArea"><TEXTAREA id=TitleBoxText readOnly style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; BORDER-RIGHT: 0px; BORDER-TOP: 0px; HEIGHT: 100%; WIDTH: 100%"></TEXTAREA></div>

<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
/*
if(!blnError){
try{
showRichTextBox("idRichTextBoxTitle","ID_TitleArea");
if(intCode>=0 && intCode<intRsNumber){
Rs.Move(intCode);
document.write("<Br>");
var strTitle=new String(Rs("M_Title"));
if(strTitle.slice(0,5)=="{\\rtf") //如果为True则表示题目的格式是RTF格式的
document.getElementById("idRichTextBoxTitle").TextRTF=strTitle;
else //否则为文本格式
document.getElementById("idRichTextBoxTitle").Text=rRs("M_Title");
document.write("<Br>");
intNumber=Rs("I_QuestionNo");
}else{
alert("没有题目了");
}
}catch(e){
blnError=true;
strErrorInfo="错误描述:" + e.description + "|错误出处:【" + strTypeName + "模块】[显示题目]";
alert(strErrorInfo.replace("|","\n"));
}
}else{
blnError=true;
alert(strErrorInfo.replace("|","\n"));
}*/
//-->
</Script>

</TD>
</TR>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
if(!blnError){
try{
//showRichTextBox("idRichTextBoxTitle","ID_TitleArea");
document.write("<tr><td colspan=8>");
document.write("<div Id='show11'> </div>");
document.write("</td></tr>");
/*
var ConnFill=new openConn(strDBAnalysisPath);
strRsFillSql="Select * From tbl_AnalysisPaper"
strRsFillSql=strRsFillSql + " Where I_TypeID=" + intTypeId
strRsFillSql=strRsFillSql+ " And I_QuestionNo=" + intNumber
RsFill.Open(strRsFillSql,ConnFill,1,1);
var strTemp=new String(RsFill("M_TopicAns"));
intFill=strTemp.split("@").length; //得到有多少个空要填
for(var i=0;i<intFill;i++)
document.write("<div Id='show"+i+"'></div>"); //显示用于显示RichTextBox的层
*/


//intRsNumber=100;
document.write("<TR><TD align=center valign=center colspan=8>");
document.write("<div id='movePrevious1'></div>");
document.write("")
for(i=1;i<=intRsNumber;i++){
//if(i>10)
// break ;
document.write("<a href='#' onclick='movego("+ i + ")'>"+(i)+" ");
}
document.write("")
document.write("<div id='moveNext1'></div>");
document.write("</TD></TR>");

/*
document.write("<TR><TD align=center valign=center colspan=8>您当前是在做 ");
document.write("<select name='toPaper' onchange='gotoOnsubmit()'>");
for(i=0;i<intRsNumber;i++)
document.write("<option value="+ i +">第 " + (i+1) + " 题</option>");
document.write("</select> </Td></TR>");
document.write("<TR><TD colspan=8><input type=hidden name=gotopaper value=ok></TD></TR>");
document.write("<TR><TD colspan=8><input type=hidden name=intTypeId value=" + intTypeId + "></TD></TR>");
document.write("<TR><TD colspan=8><input type=hidden name=strExeName value=" + strExeName + "></TD></TR>");
document.write("<TR><TD colspan=8><input type=hidden name=strTypeName value=" + strTypeName + "></TD></TR>");
document.form1.toPaper.options(intCode).selected=true;
*/

}catch(e){
blnError=true;
strErrorInfo="错误描述:" + e.description + "|错误出处:【" + strTypeName + "模块】[显示文本框]";
alert(strErrorInfo.replace("|","\n"));
}
}else{
blnError=true;
alert(strErrorInfo.replace("|","\n"));
}
//-->
</Script>
</TABLE>
</TD></TR>
</TABLE>
</Form>
</BODY>
</HTML>

原作者:冷风
来源:互联网
共有7209位读者阅读过此文

告诉好友

上篇文章:Windows XP/2000建立SMTP服务器
下篇文章:不刷新页面查询数据库中数据的方法

□- 本周热门文章 □- 本文相关文章
页面不刷新不提交来翻页
关于我们 | 联系我们 | 汇款方式 | 合作伙伴 | 独立面板
Copyright © 1999-2012 SinoCOM,Inc. All rights reserved
合作伙伴  京ICP证090221  备案编号:京ICP备10018088号  京公网安备1101060577
北京信康技术有限公司 版权所有