以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]script问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=132882)

--  作者:fstzy
--  发布时间:2019/4/1 15:19:00
--  [求助]script问题
请问老师为什么会2条一样记录加入会员表

function validit()
{
var x = document.getElementById("sjh").value
if(x.length!=11)
{
alert("请输入11位手机号码");
//show("toptip1",2000);
return false;
}

var result=submitAjaxForm(\'form1\',\'\',false);
if(result == "ok") {
return true;
}
alert(result);
return false;


Case "valid.htm"
        
        Dim sjh As String = e.Values("sjh")
        Dim yzm As String = e.Values("yzm")
        If e.Cookies.ContainsKey(sjh) = False Then
            e.WriteString("请点击发送验证码")
            Return
        End If
        If e.Cookies(sjh) <> yzm Then
            e.WriteString("验证码不正确")
            Return
        End If
        Dim cmd As new SQLCommand
        cmd.C
        cmd.CommandText = "Insert Into 会员表 (名称,密码,电话1,级别) Values(?,?,?,?)"
        cmd.Parameters.Add("@名称",e.PostValues("xm"))
        cmd.Parameters.Add("@密码",e.PostValues("mm"))
        cmd.Parameters.Add("@电话1",e.PostValues("sjh"))
        cmd.Parameters.Add("@级别","A")
        cmd.ExecuteNonQuery       
        e.WriteString("ok")
        
End Select


--  作者:有点甜
--  发布时间:2019/4/1 15:25:00
--  

1、在你的valid.htm里面加入msgbox,看弹出多少次。

 

2、贴出的代码都没问题,请做具体实例发上来测试。


--  作者:fstzy
--  发布时间:2019/4/1 15:44:00
--  
Case "test.htm"
        Dim wb1 As New weui
        wb1.AddToptips("","toptip1","请输入11位手机号码")
        wb1.AddToptips("","toptip2","你已是我们的会员")
        \'wb1.AddToptips("","toptip3","登录名称已存在")
        wb1.AddForm("","form1","valid.htm").Attribute=""
        With wb1.AddInputGroup("form1","ipg1","会员注册")
            With .AddInputCell("ic1") \'通过InputCell增加输入框
                .AddLabel("lxm","姓名:",0) \'增加标签,0显示在左边
                .AddInput("xm","text",1).Value = "张张"  \'.Required = True \'增加输入框,1表示显示在中间
            End With
            With .AddInputCell("ic2") \'通过InputCell增加输入框
                .AddLabel("lmm","密码:",0) \'增加标签,0显示在左边
                .AddInput("mm","text",1)\'.Required = True \'增加输入框,1表示显示在中间
            End With
            With .AddInputCell("ic3") \'通过InputCell增加输入框
                .AddLabel("lsj","手机",0) \'增加标签,0显示在左边
                .AddInput("sjh","text",1).Required = True\'增加输入框,1表示显示在中间
                .AddVcodeButton("vyz","获取验证码",2).Attribute=""
            End With
            With .AddInputCell("ic4") \'通过InputCell增加输入框
                .AddLabel("lyzm","验证码:",0) \'增加标签,0显示在左边
                .AddInput("yzm","text",1).Required = True \'增加输入框,1表示显示在中间
            End With
            With wb1.AddButtonGroup("form1","btg1",True)
                .Add("btn1", "确定", "submit")
            End With
        End With
        wb1.AppendHTML("<script src=\'./lib/test.js\'></script>") \'引入脚本文件
        e.WriteString(wb1.Build) \'生成网页


--  作者:fstzy
--  发布时间:2019/4/1 15:47:00
--  
在valid.htm里面加入msgbox,看弹出多少次。
结果:弹出了2次

--  作者:fstzy
--  发布时间:2019/4/1 16:25:00
--  
已上传实例
--  作者:fstzy
--  发布时间:2019/4/1 16:26:00
--  
已上传实例
--  作者:有点甜
--  发布时间:2019/4/1 16:56:00
--  

改成这种方式

 

.Add("btn1", "确定", "button").Attribute= "onclick=\'validit()\'" \'调用js函数上传

 


--  作者:fstzy
--  发布时间:2019/4/1 17:47:00
--  
可以了,谢谢