以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  实时刷新  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=107602)

--  作者:刘林
--  发布时间:2017/10/3 22:27:00
--  实时刷新

Dim e As RequestEventArgs = args(0)
Dim wb As New WeUI
If e.PostValues.Count = 0 Then \'分组统计设置
    wb.AddPageTitle("","pageheader","自测考试报名","请依次选填,入学年为学级")
    wb.AddForm("","form1","zcks.htm")
    With wb.AddInputGroup("form1","ipg1","")
        .AddSelect("学期","学       期","17秋|18春").attribute ="style=\'color:blue\'"
        .AddSelect("xd","学       段","初中|小学").attribute ="style=\'color:blue\'"
        .AddSelect("xj","学       级",DataTables("级").SQLGetComboListString("级")).attribute ="style=\'color:blue\'"
        .AddSelect("bj","班       级",DataTables("班").SQLGetComboListString("班","","序")).attribute ="style=\'color:blue\'"
        .AddSelect("km","科       目",DataTables("科目").SQLGetComboListString("科目")).attribute ="style=\'color:blue\'"
        .AddInput("ksmc","考试名称","text").attribute ="style=\'color:blue\'"
        Dim In1 =.addinput("rq","考试日期","date")
        In1.value=Date.Today
        In1.attribute ="style=\'color:blue\'"
        With.AddInput("amf","A  卷满分","number")
        .Min = "0"
        .Max = "120"
        .Step="1"
        .value="100"
        .attribute ="style=\'color:blue\'"
    End With
    With.AddInput("az","A  卷折率","number")
    .Min = "0"
    .Max = "1"
    .Step="0.01"
    .value="1"
    .attribute ="style=\'color:blue\'"
End With
With.AddInput("bmf","B  卷满分","number")
.Min = "0"
.Max = "60"
.Step="1"
.value="0"
.attribute ="style=\'color:blue\'"

End With
With.AddInput("bz","B  卷折率","number")
.Min = "0"
.Max = "1"
.Step="0.01"
.value="1"
.attribute ="style=\'color:blue\'"
End With

End With
With wb.AddButtonGroup("form1","btg1",False)
    .Add("btn1", "确定", "submit")
    .add("btn1","上分", "submit","tf.htm")
    .Add("btn1", "返回","","jwzrdefault.htm")
End With

Else \'显示统计结果
    Dim bjhc As String = trim(e.PostValues("xd") & e.PostValues("xj") & e.PostValues("bj"))
    wb.AppendCookie("xq",e.PostValues("学期"))
    wb.AppendCookie("bj",bjhc)
    wb.AppendCookie("km",e.PostValues("km"))
    wb.AppendCookie("ksmc",e.PostValues("ksmc"))
    wb.AddPageTitle("","pageheader","学生成绩表册",e.postvalues("学期") & ">" & bjhc & ">" & e.postvalues("km") & ">" & e.PostValues("ksmc"))
    \' wb.AddForm("","form1","")
    Dim dr As DataRow = DataTables("用户").sqlfind("身份证号 = \'" & e.Cookies("username") & "\'")
    Dim xss As List(Of DataRow)
    xss = DataTables("学生信息").sqlSelect("学校名称 = \'" & dr("group") & "\' And 班级 = \'" & bjhc & "\' and left(状态,2) =\'在读\'")
    For Each xs As DataRow In xss
        Dim pr As DataRow
        pr =DataTables("自测成绩").sqlfind("学期= \'"& e.PostValues("学期") & "\' and 学校名称 = \'" & dr("group") & "\' and 班级 = \'" & bjhc & "\' And 考试名称 =\'" & e.PostValues("ksmc") & "\' and 科目 = \'" & e.PostValues("km") & "\' and 身份证号 = \'" & xs("身份证件号") & "\'")
        If pr Is Nothing
            pr = DataTables("自测成绩").addnew()
        End If
        pr("学校名称")= dr("group")
        pr("考试名称")= e.PostValues("ksmc")
        pr("科目") =e.PostValues("km")
        pr("班级") = xs("班级")
        pr("姓名")=xs("学生姓名")
        pr("身份证号")=xs("身份证件号")
        pr("学期") = e.PostValues("学期")
        pr("考试日期")= e.postvalues("rq")
        pr("A卷满分")=val(e.postvalues("amf"))
        pr("B卷满分")=val(e.postvalues("bmf"))
        pr("A卷折率")=val(e.postvalues("az"))
        pr("B卷折率")=val(e.postvalues("bz"))
        pr("教师身份证")= e.Cookies("username")
        pr.save()
    Next
    wb.AddToast("","t1", "正在上传",1) \'定义提示
    wb.AddForm("","form1","cjsave.htm").attribute= """
    With wb.AddButtonGroup("form1","btg1", False)  \'水平排列
        .Add("btn6", "保存","submit")
        .Add("btn7", "返回","button","tfsz.htm")\'.Attribute = ""
    End With
    Dim xss1 As List(Of DataRow)  =DataTables("自测成绩").sqlselect("学期= \'"& e.PostValues("学期") & "\' And 班级 = \'" & bjhc & "\' And 考试名称 =\'" & e.PostValues("ksmc") & "\' and 科目 = \'" & e.PostValues("km") & "\' and 教师身份证 = \'" & e.Cookies("username") & "\'","","总分 desc,姓名")
    wb.InsertHTML("form1", "<Table border=1 cellspacing=0 style=\'width:100%;text-align:center;\'><tr><td style=\'text-align:center;font-size: 15pt;strong\'>姓名</td><td style=\'text-align:center;font-size: 15pt\'>A卷</td><td style=\'text-align:center;font-size: 15pt\'>B卷</td><td style=\'text-align:center;font-size: 15pt\'>总分</td></tr>")
    For Each xs1 As DataRow In xss1
        wb.insertHtml("form1", "<tr><td style=\'width:25%;font-size:15pt\' >" & xs1("姓名") & "</td><td style=\'width:25%\'><input style=\'width:95%;font-size: 15pt; border:none;text-align:center;\' type=\'number\' max= \'" & xs1("A卷满分") & "\'  min =\'0\' name=\'txt1_" & xs1("_Identify") & "\' value=\'" & iif(xs1("A卷")>0, xs1("A卷"),"") & "\' /></td><td style=\'width:25%\'><input style=\'width:95%;font-size:15pt;border:none;text-align:center;\' type= \'number\' max= \'" & xs1("B卷满分") & "\'  name=\'txt2_" & xs1("_Identify") & "\'  value=\'" & iif(xs1("B卷")>0,xs1("B卷"),"") & "\' /></td><td style=\'width:25%;font-size:15pt\' >" & xs1("总分") & "</td></tr>")
    Next
    Dim pja As Double = DataTables("自测成绩").SQLCompute("avg(A卷)","学期= \'"& e.PostValues("学期") & "\' And 班级 = \'" & bjhc & "\' And 考试名称 =\'" & e.PostValues("ksmc") & "\' and 科目 = \'" & e.PostValues("km") & "\' and 教师身份证 = \'" & e.Cookies("username") & "\' and 总分>0")
    Dim pjb As Double = DataTables("自测成绩").SQLCompute("avg(B卷)","学期= \'"& e.PostValues("学期") & "\' And 班级 = \'" & bjhc & "\' And 考试名称 =\'" & e.PostValues("ksmc") & "\' and 科目 = \'" & e.PostValues("km") & "\' and 教师身份证 = \'" & e.Cookies("username") & "\'and 总分>0")
    Dim pjzf As Double = DataTables("自测成绩").SQLCompute("avg(总分)","学期= \'"& e.PostValues("学期") & "\' And 班级 = \'" & bjhc & "\' And 考试名称 =\'" & e.PostValues("ksmc") & "\' and 科目 = \'" & e.PostValues("km") & "\' and 教师身份证 = \'" & e.Cookies("username") & "\'and 总分>0")
    wb.insertHtml("form1", "<tr><td style=\'width:25%;font-size:15pt\' >平均分</td><td style=\'width:25%;font-size:15pt\' >" & Format(pja,"0.00") & "</td><td style=\'width:25%;font-size:15pt\' >" & Format(pjb,"0.00") & "</td><td style=\'width:25%;font-size:15pt\' >" & Format(pjzf,"0.00") & "</td></tr>")
    wb.insertHtml("form1", "</Table>")
End If
e.WriteString(wb.Build)

 

 

 

Dim e As RequestEventArgs = args(0)
Dim wb As New WeUI
Dim bjhc As String = trim(e.PostValues("xd") & e.PostValues("xj") & e.PostValues("bj"))
wb.AddPageTitle("","pageheader","学生成绩保存")
wb.AddForm("","form1","")
Dim dr As DataRow = DataTables("用户").sqlfind("身份证号 = \'" & e.Cookies("username") & "\'")
For Each key As String In e.Values.Keys
  Dim jlh As String = key.split("_")(1)
    Dim fdr As DataRow = DataTables("自测成绩").sqlfind("_Identify = \'" & jlh & "\'")
    fdr("A卷") = val(e.values("txt1_" & jlh))
    fdr("B卷") = val(e.values("txt2_" & jlh))
    fdr("总分")= val(e.values("txt1_" & jlh)) +val(e.values("txt2_" & jlh))
    fdr.save()
Next
With wb.AddButtonGroup("form1","btg1", False)  \'水平排列
    .Add("btn6", "保存","submit")
    .Add("btn7", "返回","button").Attribute = ""
End With
wb.AppendHTML("<script src=\'./lib/order.js\'></script>")
e.WriteString(wb.Build)

 

 

老师,你好,上面代码经过测试终于基本达到我想要的结果,现在有一个问题:用这个方式传给cjsave.htm保存,返回后表格数据中的总分以及表尾的平均分不刷新,我想上传数据后立即在zcks.htm中刷新上传后的结果,并可继续录入成绩,这该怎么修改。谢谢


--  作者:刘林
--  发布时间:2017/10/4 10:48:00
--  

请老师帮看一下


--  作者:有点蓝
--  发布时间:2017/10/4 11:42:00
--  
返回后重新从数据库中查询数据,重新生成网页
--  作者:刘林
--  发布时间:2017/10/4 14:15:00
--  

这个我知道,我现在就是想如何改进实现,保存后就能重新生成网页,而不用返回


--  作者:有点蓝
--  发布时间:2017/10/4 14:32:00
--  
代码放到一起

……
Else \'显示统计结果
    Dim bjhc As String = trim(e.PostValues("xd") & e.PostValues("xj") & e.PostValues("bj"))
    wb.AppendCookie("xq",e.PostValues("学期"))
    wb.AppendCookie("bj",bjhc)
    wb.AppendCookie("km",e.PostValues("km"))
    wb.AppendCookie("ksmc",e.PostValues("ksmc"))
    wb.AddPageTitle("","pageheader","学生成绩表册",e.postvalues("学期") & ">" & bjhc & ">" & e.postvalues("km") & ">" & e.PostValues("ksmc"))
    \' wb.AddForm("","form1","")
    Dim dr As DataRow = DataTables("用户").sqlfind("身份证号 = \'" & e.Cookies("username") & "\'")
    Dim xss As List(Of DataRow)
    xss = DataTables("学生信息").sqlSelect("学校名称 = \'" & dr("group") & "\' And 班级 = \'" & bjhc & "\' and left(状态,2) =\'在读\'")
    For Each xs As DataRow In xss
        Dim pr As DataRow
        pr =DataTables("自测成绩").sqlfind("学期= \'"& e.PostValues("学期") & "\' and 学校名称 = \'" & dr("group") & "\' and 班级 = \'" & bjhc & "\' And 考试名称 =\'" & e.PostValues("ksmc") & "\' and 科目 = \'" & e.PostValues("km") & "\' and 身份证号 = \'" & xs("身份证件号") & "\'")
        If pr Is Nothing
            pr = DataTables("自测成绩").addnew()
        End If
        pr("学校名称")= dr("group")
        pr("考试名称")= e.PostValues("ksmc")
        pr("科目") =e.PostValues("km")
        pr("班级") = xs("班级")
        pr("姓名")=xs("学生姓名")
        pr("身份证号")=xs("身份证件号")
        pr("学期") = e.PostValues("学期")
        pr("考试日期")= e.postvalues("rq")
        pr("A卷满分")=val(e.postvalues("amf"))
        pr("B卷满分")=val(e.postvalues("bmf"))
        pr("A卷折率")=val(e.postvalues("az"))
        pr("B卷折率")=val(e.postvalues("bz"))
        pr("教师身份证")= e.Cookies("username")
        pr.save()
    Next
    For Each key As String In e.Values.Keys
        If key.Contains("txt1_")
            Dim jlh As String = key.split("_")(1)
            Dim fdr As DataRow = DataTables("自测成绩").sqlfind("_Identify = \'" & jlh & "\'")
            fdr("A卷") = val(e.values("txt1_" & jlh))
            fdr("B卷") = val(e.values("txt2_" & jlh))
            fdr("总分")= val(e.values("txt1_" & jlh)) +val(e.values("txt2_" & jlh))
            fdr.save()
        End If
    Next
    wb.AddToast("","t1", "正在上传",1) \'定义提示
    wb.AddForm("","form1","tfsz.htm").attribute= """
    With wb.AddButtonGroup("form1","btg1", False)  \'水平排列
        .Add("btn6", "保存","submit")
        \'.Add("btn7", "返回","button","tfsz.htm")\'.Attribute = ""
    End With
    Dim xss1 As List(Of DataRow)  =DataTables("自测成绩").sqlselect("学期= \'"& e.PostValues("学期") & "\' And 班级 = \'" & bjhc & "\' And 考试名称 =\'" & e.PostValues("ksmc") & "\' and 科目 = \'" & e.PostValues("km") & "\' and 教师身份证 = \'" & e.Cookies("username") & "\'","","总分 desc,姓名")
    wb.InsertHTML("form1", "<Table border=1 cellspacing=0 style=\'width:100%;text-align:center;\'><tr><td style=\'text-align:center;font-size: 15pt;strong\'>姓名</td><td style=\'text-align:center;font-size: 15pt\'>A卷</td><td style=\'text-align:center;font-size: 15pt\'>B卷</td><td style=\'text-align:center;font-size: 15pt\'>总分</td></tr>")
    For Each xs1 As DataRow In xss1
        wb.insertHtml("form1", "<tr><td style=\'width:25%;font-size:15pt\' >" & xs1("姓名") & "</td><td style=\'width:25%\'><input style=\'width:95%;font-size: 15pt; border:none;text-align:center;\' type=\'number\' max= \'" & xs1("A卷满分") & "\'  min =\'0\' name=\'txt1_" & xs1("_Identify") & "\' value=\'" & iif(xs1("A卷")>0, xs1("A卷"),"") & "\' /></td><td style=\'width:25%\'><input style=\'width:95%;font-size:15pt;border:none;text-align:center;\' type= \'number\' max= \'" & xs1("B卷满分") & "\'  name=\'txt2_" & xs1("_Identify") & "\'  value=\'" & iif(xs1("B卷")>0,xs1("B卷"),"") & "\' /></td><td style=\'width:25%;font-size:15pt\' >" & xs1("总分") & "</td></tr>")
    Next
……

--  作者:刘林
--  发布时间:2017/10/6 9:46:00
--  

录分设置:

Dim e As RequestEventArgs = args(0)
Dim wb As New WeUI
wb.AddPageTitle("","pageheader","自测考试录入","请依次选填")
wb.AddForm("","form1","cjbiao.htm")
With wb.AddInputGroup("form1","ipg1","")
    .AddSelect("学期","学期",DataTables("自测成绩").SQLGetComboListString("学期","教师身份证= \'" & e.Cookies("username") & "\'","考试日期 desc"))
    .AddSelect("bj","班级",DataTables("自测成绩").SQLGetComboListString("班级","教师身份证= \'" & e.Cookies("username") & "\'","考试日期 desc"))
    .AddSelect("km","科目",DataTables("自测成绩").SQLGetComboListString("科目","教师身份证= \'" & e.Cookies("username") & "\'","考试日期 desc"))
    .Addselect("ksmc","考试名称",DataTables("自测成绩").SQLGetComboListString("考试名称","教师身份证= \'" & e.Cookies("username") & "\'","考试日期 desc"))
End With
With wb.AddButtonGroup("form1","btg1",False)
    .Add("btn1", "确定", "submit")
    .Add("btn1", "返回","","jwzrdefault.htm")
End With
e.WriteString(wb.Build)

 

 

录分表、统计表

Dim e As RequestEventArgs = args(0)
Dim wb As New WeUI

wb.AddPageTitle("","pageheader","学生成绩表册",e.postvalues("学期") & ">" & e.postvalues("bj") & ">" & e.postvalues("km") & ">" & e.PostValues("ksmc"))
wb.AddToast("","t1", "正在上传",1) \'定义提示
wb.AddForm("","form1","cjsave.htm").attribute= """
With wb.AddButtonGroup("form1","btg1", False)  \'水平排列
    .Add("btn6", "保存","submit")
    .Add("btn7", "返回","button","tfsz.htm")\'.Attribute = ""
End With
Dim dr As DataRow = DataTables("用户").sqlfind("身份证号 = \'" & e.Cookies("username") & "\'")
Dim bjf As DataRow =DataTables("自测成绩").sqlfind("学期= \'"& e.PostValues("学期") & "\' And 班级 = \'" & e.postvalues("bj") & "\' And 考试名称 =\'" & e.PostValues("ksmc") & "\' and 科目 = \'" & e.PostValues("km") & "\' and 教师身份证 = \'" & e.Cookies("username") & "\'")

If bjf IsNot Nothing
If bjf("B卷满分")>0
    Dim xss As List(Of DataRow)  =DataTables("自测成绩").sqlselect("学期= \'"& e.PostValues("学期") & "\' And 班级 = \'" & e.postvalues("bj") & "\' And 考试名称 =\'" & e.PostValues("ksmc") & "\' and 科目 = \'" & e.PostValues("km") & "\' and 教师身份证 = \'" & e.Cookies("username") & "\'","","折总 desc,姓名")
    For n As Integer = 0 To xss.Count - 1 \'遍历所有行
        If n > 0 AndAlso xss(n)("折总") = xss(n-1)("折总") Then \'如果总分和上一行相同
            xss(n)("折序") = xss(n-1)("折序") \'则排名等于上一行
        Else
            xss(n)("折序") = n + 1 \'设置排名
        End If
    Next
    wb.InsertHTML("form1", "<Table border=1 cellspacing=0 style=\'width:100%;text-align:center;\'><tr><td style=\'text-align:center;font-size: 15pt;strong\'>姓名</td><td style=\'text-align:center;font-size: 15pt\'>A卷</td><td style=\'text-align:center;font-size: 15pt\'>B卷</td><td style=\'text-align:center;font-size: 15pt\'>折总</td><td style=\'text-align:center;font-size: 15pt\'>折序</td></tr>")
    For Each xs As DataRow In xss
        wb.insertHtml("form1", "<tr><td style=\'width:20%;font-size:15pt\' >" & xs("姓名") & "</td><td style=\'width:20%\'><input style=\'width:95%;font-size: 15pt; border:none;text-align:center;\' type=\'number\'  name=\'txt1_" & xs("_Identify") & "\' max= \'" & xs("A卷满分") & "\'  min =\'0\' value=\'" & iif(xs("A卷")>0, xs("A卷"),"") & "\' /></td><td style=\'width:20%\'><input style=\'width:95%;font-size:15pt;border:none;text-align:center;\' type= \'number\'  name=\'txt2_" & xs("_Identify") & "\' max= \'" & xs("B卷满分") & "\'  min =\'0\' value=\'" & iif(xs("B卷")>0,xs("B卷"),"") & "\' /></td><td style=\'width:20%;font-size:15pt\' >" & iif(xs("折总")>0, xs("折总"),"") & "</td></td><td style=\'width:20%;font-size:15pt\' >" & iif(xs("折序")>0, xs("折序"),"") & "</td></tr>")
    Next
    Dim pja As Double = DataTables("自测成绩").SQLCompute("avg(A卷)","学期= \'"& e.PostValues("学期") & "\' And 班级 = \'" & e.postvalues("bj") & "\' And 考试名称 =\'" & e.PostValues("ksmc") & "\' and 科目 = \'" & e.PostValues("km") & "\' and 教师身份证 = \'" & e.Cookies("username") & "\' and 总分>0")
    Dim pjb As Double = DataTables("自测成绩").SQLCompute("avg(B卷)","学期= \'"& e.PostValues("学期") & "\' And 班级 = \'" & e.postvalues("bj") & "\' And 考试名称 =\'" & e.PostValues("ksmc") & "\' and 科目 = \'" & e.PostValues("km") & "\' and 教师身份证 = \'" & e.Cookies("username") & "\'and 总分>0")
    Dim pjzf As Double = DataTables("自测成绩").SQLCompute("avg(折总)","学期= \'"& e.PostValues("学期") & "\' And 班级 = \'" & e.postvalues("bj") & "\' And 考试名称 =\'" & e.PostValues("ksmc") & "\' and 科目 = \'" & e.PostValues("km") & "\' and 教师身份证 = \'" & e.Cookies("username") & "\'and 总分>0")
    wb.insertHtml("form1", "<tr><td style=\'width:20%;font-size:15pt\' >平均分</td><td style=\'width:20%;font-size:15pt\' >" & Format(pja,"0.00") & "</td><td style=\'width:20%;font-size:15pt\' >" & Format(pjb,"0.00") & "</td><td style=\'width:20%;font-size:15pt\' >" & Format(pjzf,"0.00") & "</td></td><td style=\'width:20%;font-size:15pt\' ></td></tr>")
    wb.insertHtml("form1", "</Table>")
Else
    Dim xss As List(Of DataRow)  =DataTables("自测成绩").sqlselect("学期= \'"& e.PostValues("学期") & "\' And 班级 = \'" & e.postvalues("bj") & "\' And 考试名称 =\'" & e.PostValues("ksmc") & "\' and 科目 = \'" & e.PostValues("km") & "\' and 教师身份证 = \'" & e.Cookies("username") & "\'","","总分 desc,姓名")
    For n As Integer = 0 To xss.Count - 1 \'遍历所有行
        If n > 0 AndAlso xss(n)("总分") = xss(n-1)("总分") Then \'如果总分和上一行相同
            xss(n)("总序") = xss(n-1)("总序") \'则排名等于上一行
        Else
            xss(n)("总序") = n + 1 \'设置排名
        End If
    Next
    wb.InsertHTML("form1", "<Table border=1 cellspacing=0 style=\'width:100%;text-align:center;\'><tr><td style=\'text-align:center;font-size: 15pt;strong\'>姓名</td><td style=\'text-align:center;font-size: 15pt\'>A卷</td><td style=\'text-align:center;font-size: 15pt\'>总分</td><td style=\'text-align:center;font-size: 15pt\'>总序</td></tr>")
    For Each xs As DataRow In xss
        wb.insertHtml("form1", "<tr><td style=\'width:20%;font-size:15pt\' >" & xs("姓名") & "</td><td style=\'width:20%\'><input style=\'width:95%;font-size: 15pt; border:none;text-align:center;\' type=\'number\'  name=\'txt1_" & xs("_Identify") & "\' max= \'" & xs("A卷满分") & "\'  min =\'0\' value=\'" & iif(xs("A卷")>0, xs("A卷"),"") & "\' /><td style=\'width:20%;font-size:15pt\' >" & iif(xs("总分")>0, xs("总分"),"") & "</td></td><td style=\'width:20%;font-size:15pt\'>" & iif(xs("总序")>0, xs("总序"),"") & "</td></tr>")
    Next
    Dim pja As Double = DataTables("自测成绩").SQLCompute("avg(A卷)","学期= \'"& e.PostValues("学期") & "\' And 班级 = \'" & e.postvalues("bj") & "\' And 考试名称 =\'" & e.PostValues("ksmc") & "\' and 科目 = \'" & e.PostValues("km") & "\' and 教师身份证 = \'" & e.Cookies("username") & "\' and 折总>0")
    \'\'Dim pjb As Double = DataTables("自测成绩").SQLCompute("avg(B卷)","学期= \'"& e.PostValues("学期") & "\' And 班级 = \'" & e.postvalues("bj") & "\' And 考试名称 =\'" & e.PostValues("ksmc") & "\' and 科目 = \'" & e.PostValues("km") & "\' and 教师身份证 = \'" & e.Cookies("username") & "\'and 折总>0")
    Dim pjzf As Double = DataTables("自测成绩").SQLCompute("avg(折总)","学期= \'"& e.PostValues("学期") & "\' And 班级 = \'" & e.postvalues("bj") & "\' And 考试名称 =\'" & e.PostValues("ksmc") & "\' and 科目 = \'" & e.PostValues("km") & "\' and 教师身份证 = \'" & e.Cookies("username") & "\'and 折总>0")
    wb.insertHtml("form1", "<tr><td style=\'width:25%;font-size:15pt\' >平均分</td><td style=\'width:25%;font-size:15pt\' >" & Format(pja,"0.00") & "</td><td style=\'width:25%;font-size:15pt\' >" & Format(pjzf,"0.00") & "</td></td></td><td style=\'width:25%;font-size:15pt\' ></td></tr>")
    wb.insertHtml("form1", "</Table>")
End If
End If
e.WriteString(wb.Build)

 

 

录分保存

Dim e As RequestEventArgs = args(0)
Dim wb As New WeUI
Dim bjhc As String = trim(e.PostValues("xd") & e.PostValues("xj") & e.PostValues("bj"))
wb.AddPageTitle("","pageheader","学生成绩保存")
wb.AddForm("","form1","")
Dim dr As DataRow = DataTables("用户").sqlfind("身份证号 = \'" & e.Cookies("username") & "\'")
For Each key As String In e.Values.Keys
  Dim jlh As String = key.split("_")(1)
    Dim fdr As DataRow = DataTables("自测成绩").sqlfind("_Identify = \'" & jlh & "\'")
    fdr("A卷") = val(e.values("txt1_" & jlh))
    fdr("B卷") = val(e.values("txt2_" & jlh))
    fdr("折总")=val(e.values("txt1_" & jlh))*val(fdr("A卷折率"))+ val(e.values("txt2_" & jlh))*val(fdr("B卷折率"))
    fdr("总分")= val(e.values("txt1_" & jlh)) +val(e.values("txt2_" & jlh))
    fdr.save()
Next
With wb.AddButtonGroup("form1","btg1", False)  \'水平排列
    .Add("btn6", "保存","submit")
    .Add("btn7", "返回","button").Attribute = ""
End With
wb.AppendHTML("<script src=\'./lib/order.js\'></script>")
e.WriteString(wb.Build)

 

请问老师,上面三个代码如何save这一段并在第二段中实现保存后刷新cjbiao,这样可保存后就刷新统计数据并继续录入,谢谢


--  作者:有点甜
--  发布时间:2017/10/6 9:55:00
--  

1、用异步提交

 

http://www.foxtable.com/mobilehelp/scr/0101.htm

 

2、用js,提交表单以后,刷新页面,也就是加上  location.reload();


--  作者:刘林
--  发布时间:2017/10/6 12:55:00
--  

老师,看了没懂起,js不懂,请帮忙写下示范,谢谢


--  作者:有点甜
--  发布时间:2017/10/6 15:40:00
--  

function myfunction(){
    var result = submitAjaxForm(\'form1\',\'\',false);
    If (result ==\'OK\') {

        location.reload();

    } else {

        showDialog(\'dlg2\',\'错误\',result)}
}

 

http://www.foxtable.com/mobilehelp/scr/0101.htm

 


--  作者:刘林
--  发布时间:2017/10/6 18:43:00
--  

 

cjbiao.htm

Dim e As RequestEventArgs = args(0)
Dim wb As New WeUI

wb.AddPageTitle("","pageheader","学生成绩表册",e.postvalues("学期") & ">" & e.postvalues("bj") & ">" & e.postvalues("km") & ">" & e.PostValues("ksmc"))
wb.AddToast("","t1", "正在上传",1) \'定义提示
wb.AddForm("","form1","cjsave.htm")\'.attribute= """
With wb.AddButtonGroup("form1","btg1", False)  \'水平排列
    .Add("btn6", "保存","submit")\'.Attribute= ""
    .Add("btn6", "统计","button").Attribute=""
    .Add("btn7", "返回","button","tfsz.htm")\'.Attribute = ""
End With
With wb.AddDialog("","dlg1", "提示","保存成功,是否继续录入") \'增加订单成功提示框
    .AddButton("btnYes","是").Attribute = ""
    .AddButton("btnNo","否").Kind = 1
End With
With wb.AddDialog("","dlg2", "错误","") \'增加订单失败提示框
    .AddButton("btnOK","确定")
End With
Dim dr As DataRow = DataTables("用户").sqlfind("身份证号 = \'" & e.Cookies("username") & "\'")
Dim bjf As DataRow =DataTables("自测成绩").sqlfind("学期= \'"& e.PostValues("学期") & "\' And 班级 = \'" & e.postvalues("bj") & "\' And 考试名称 =\'" & e.PostValues("ksmc") & "\' and 科目 = \'" & e.PostValues("km") & "\' and 教师身份证 = \'" & e.Cookies("username") & "\'")
If bjf IsNot Nothing
    If bjf("B卷满分")>0
        Dim xss As List(Of DataRow)  =DataTables("自测成绩").sqlselect("学期= \'"& e.PostValues("学期") & "\' And 班级 = \'" & e.postvalues("bj") & "\' And 考试名称 =\'" & e.PostValues("ksmc") & "\' and 科目 = \'" & e.PostValues("km") & "\' and 教师身份证 = \'" & e.Cookies("username") & "\'","","折总 desc,姓名")
        For n As Integer = 0 To xss.Count - 1 \'遍历所有行
            If n > 0 AndAlso xss(n)("折总") = xss(n-1)("折总") Then \'如果总分和上一行相同
                xss(n)("折序") = xss(n-1)("折序") \'则排名等于上一行
            Else
                xss(n)("折序") = n + 1 \'设置排名
            End If
        Next
        wb.InsertHTML("form1", "<Table border=1 cellspacing=0 style=\'width:100%;text-align:center;\'><tr><td style=\'text-align:center;font-size: 15pt;strong\'>姓名</td><td style=\'text-align:center;font-size: 15pt\'>A卷</td><td style=\'text-align:center;font-size: 15pt\'>B卷</td><td style=\'text-align:center;font-size: 15pt\'>折总</td><td style=\'text-align:center;font-size: 15pt\'>折序</td></tr>")
        For Each xs As DataRow In xss
            wb.insertHtml("form1", "<tr><td style=\'width:20%;font-size:15pt\' >" & xs("姓名") & "</td><td style=\'width:20%\'><input style=\'width:95%;font-size: 15pt; border:none;text-align:center;\' type=\'number\'  name=\'txt1_" & xs("_Identify") & "\' max= \'" & xs("A卷满分") & "\'  min =\'0\' value=\'" & iif(xs("A卷")>0, xs("A卷"),"") & "\' /></td><td style=\'width:20%\'><input style=\'width:95%;font-size:15pt;border:none;text-align:center;\' type= \'number\'  name=\'txt2_" & xs("_Identify") & "\' max= \'" & xs("B卷满分") & "\'  min =\'0\' value=\'" & iif(xs("B卷")>0,xs("B卷"),"") & "\' /></td><td style=\'width:20%;font-size:15pt\' >" & iif(xs("折总")>0, xs("折总"),"") & "</td></td><td style=\'width:20%;font-size:15pt\' >" & iif(xs("折序")>0, xs("折序"),"") & "</td></tr>")
        Next
        Dim pja As Double = DataTables("自测成绩").SQLCompute("avg(A卷)","学期= \'"& e.PostValues("学期") & "\' And 班级 = \'" & e.postvalues("bj") & "\' And 考试名称 =\'" & e.PostValues("ksmc") & "\' and 科目 = \'" & e.PostValues("km") & "\' and 教师身份证 = \'" & e.Cookies("username") & "\' and 总分>0")
        Dim pjb As Double = DataTables("自测成绩").SQLCompute("avg(B卷)","学期= \'"& e.PostValues("学期") & "\' And 班级 = \'" & e.postvalues("bj") & "\' And 考试名称 =\'" & e.PostValues("ksmc") & "\' and 科目 = \'" & e.PostValues("km") & "\' and 教师身份证 = \'" & e.Cookies("username") & "\'and 总分>0")
        Dim pjzf As Double = DataTables("自测成绩").SQLCompute("avg(折总)","学期= \'"& e.PostValues("学期") & "\' And 班级 = \'" & e.postvalues("bj") & "\' And 考试名称 =\'" & e.PostValues("ksmc") & "\' and 科目 = \'" & e.PostValues("km") & "\' and 教师身份证 = \'" & e.Cookies("username") & "\'and 总分>0")
        wb.insertHtml("form1", "<tr><td style=\'width:20%;font-size:15pt\' >平均分</td><td style=\'width:20%;font-size:15pt\' >" & Format(pja,"0.00") & "</td><td style=\'width:20%;font-size:15pt\' >" & Format(pjb,"0.00") & "</td><td style=\'width:20%;font-size:15pt\' >" & Format(pjzf,"0.00") & "</td></td><td style=\'width:20%;font-size:15pt\' ></td></tr>")
        wb.insertHtml("form1", "</Table>")
    Else
        Dim xss As List(Of DataRow)  =DataTables("自测成绩").sqlselect("学期= \'"& e.PostValues("学期") & "\' And 班级 = \'" & e.postvalues("bj") & "\' And 考试名称 =\'" & e.PostValues("ksmc") & "\' and 科目 = \'" & e.PostValues("km") & "\' and 教师身份证 = \'" & e.Cookies("username") & "\'","","总分 desc,姓名")
        For n As Integer = 0 To xss.Count - 1 \'遍历所有行
            If n > 0 AndAlso xss(n)("总分") = xss(n-1)("总分") Then \'如果总分和上一行相同
                xss(n)("总序") = xss(n-1)("总序") \'则排名等于上一行
            Else
                xss(n)("总序") = n + 1 \'设置排名
            End If
        Next
        wb.InsertHTML("form1", "<Table border=1 cellspacing=0 style=\'width:100%;text-align:center;\'><tr><td style=\'text-align:center;font-size: 15pt;strong\'>姓名</td><td style=\'text-align:center;font-size: 15pt\'>A卷</td><td style=\'text-align:center;font-size: 15pt\'>总分</td><td style=\'text-align:center;font-size: 15pt\'>总序</td></tr>")
        For Each xs As DataRow In xss
            wb.insertHtml("form1", "<tr><td style=\'width:20%;font-size:15pt\' >" & xs("姓名") & "</td><td style=\'width:20%\'><input style=\'width:95%;font-size: 15pt; border:none;text-align:center;\' type=\'number\'  name=\'txt1_" & xs("_Identify") & "\' max= \'" & xs("A卷满分") & "\'  min =\'0\' value=\'" & iif(xs("A卷")>0, xs("A卷"),"") & "\' /><td style=\'width:20%;font-size:15pt\' >" & iif(xs("总分")>0, xs("总分"),"") & "</td></td><td style=\'width:20%;font-size:15pt\'>" & iif(xs("总序")>0, xs("总序"),"") & "</td></tr>")
        Next
        Dim pja As Double = DataTables("自测成绩").SQLCompute("avg(A卷)","学期= \'"& e.PostValues("学期") & "\' And 班级 = \'" & e.postvalues("bj") & "\' And 考试名称 =\'" & e.PostValues("ksmc") & "\' and 科目 = \'" & e.PostValues("km") & "\' and 教师身份证 = \'" & e.Cookies("username") & "\' and 折总>0")
        \'\'Dim pjb As Double = DataTables("自测成绩").SQLCompute("avg(B卷)","学期= \'"& e.PostValues("学期") & "\' And 班级 = \'" & e.postvalues("bj") & "\' And 考试名称 =\'" & e.PostValues("ksmc") & "\' and 科目 = \'" & e.PostValues("km") & "\' and 教师身份证 = \'" & e.Cookies("username") & "\'and 折总>0")
        Dim pjzf As Double = DataTables("自测成绩").SQLCompute("avg(折总)","学期= \'"& e.PostValues("学期") & "\' And 班级 = \'" & e.postvalues("bj") & "\' And 考试名称 =\'" & e.PostValues("ksmc") & "\' and 科目 = \'" & e.PostValues("km") & "\' and 教师身份证 = \'" & e.Cookies("username") & "\'and 折总>0")
        wb.insertHtml("form1", "<tr><td style=\'width:25%;font-size:15pt\' >平均分</td><td style=\'width:25%;font-size:15pt\' >" & Format(pja,"0.00") & "</td><td style=\'width:25%;font-size:15pt\' >" & Format(pjzf,"0.00") & "</td></td></td><td style=\'width:25%;font-size:15pt\' ></td></tr>")
        wb.insertHtml("form1", "</Table>")
    End If
End If
wb.AppendHTML("<script src=\'./lib/ajaxform.js\'></script>")
e.WriteString(wb.Build)

 

 

cjsave.htm

 

Dim e As RequestEventArgs = args(0)
Dim wb As New WeUI
Dim bjhc As String = trim(e.PostValues("xd") & e.PostValues("xj") & e.PostValues("bj"))
wb.AddPageTitle("","pageheader","学生成绩保存")
wb.AddForm("","form1","")
Dim dr As DataRow = DataTables("用户").sqlfind("身份证号 = \'" & e.Cookies("username") & "\'")
For Each key As String In e.Values.Keys
  Dim jlh As String = key.split("_")(1)
    Dim fdr As DataRow = DataTables("自测成绩").sqlfind("_Identify = \'" & jlh & "\'")
    fdr("A卷") = val(e.values("txt1_" & jlh))
    fdr("B卷") = val(e.values("txt2_" & jlh))
    fdr("折总")=val(e.values("txt1_" & jlh))*val(fdr("A卷折率"))+ val(e.values("txt2_" & jlh))*val(fdr("B卷折率"))
    fdr("总分")= val(e.values("txt1_" & jlh)) +val(e.values("txt2_" & jlh))
    fdr.save()
Next
With wb.AddButtonGroup("form1","btg1", False)  \'水平排列
  \'\'  .Add("btn6", "保存","submit")
    .Add("btn7", "返回","button").Attribute = ""
End With
wb.AppendHTML("<script src=\'./lib/order.js\'></script>")
e.WriteString(wb.Build)

 

老师你好,我按照你的指导做了测试还是不行呢,我就加了一个.Add("btn6", "统计","button").Attribute="",用来保存后手动返回cjbiao再手动刷新成绩表,这样就多了两个步骤,还是想只要保存后就恻刷新,就问如何改,js写了也不行呢。请老师帮指导,谢谢