以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  button类型按钮值获取  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=171311)

--  作者:qwz405
--  发布时间:2021/8/25 19:57:00
--  button类型按钮值获取
button类型按钮,如果判断操作者按了哪个按钮:同意 or 拒绝

 1、按钮代码如下所示:
   With wb.AddButtonGroup("form1","btg1",False)
        With .Add("btn1", "同意", "button")
            .Kind = 2
            .Value = "同意"
            .Attribute= "o n click=\'s u b m itForm()\'"    \'调用js函数上传
        End With
        With .Add("btn1", "拒绝","button")
            .Kind = 2
            .Value = "拒绝"     \'用于判断按了哪个键
            .Attribute= "o n c lick=\'s u b m itForm2()\'"    \'调用js函数上传
        End With
    End With


2、JS代码如下所示:
f u nction s u bmitForm2(){
   var v1 = d o cument.getElementById("临时编号").value;      //必填,20字以内
   if (v1){
       show("tst1",2000);
       var result = s u bmitAjaxForm(\'form1\',\'afterSubmit2\');
    }
   else{
       show("toptip1",2500);
       return false;
    }
}

f u nction  a fterSubmit2(result){
    h ide("tst1");
    if (r esult==\'OK\') {
        show("tst2");
        l o cation="dd.htm?v="+M ath.r andom();    
    }
    else if (r esult==\'NG1\') {
s how("tst3");
                l o cation="cc.htm?key=1&v="+M ath.r andom();
    }
else{
show("tst3");
                l o cation="cc.htm?key=88&v="+M ath.r andom();
    }
}


3、无法获取 btn1的值。             
Dim btn1 As String = e.PostValues("btn1") 
[此贴子已经被作者于2021/8/25 19:58:39编辑过]

--  作者:有点蓝
--  发布时间:2021/8/26 8:37:00
--  
控件id不能重复

        With .Add("btn1", "同意", "button")
            .Kind = 2
            .Value = "同意"
            .Attribute= "o n click=\'s u b m itForm()\'"    \'调用js函数上传
        End With
        With .Add("btn2", "拒绝","button")
            .Kind = 2
            .Value = "拒绝"     \'用于判断按了哪个键
            .Attribute= "o n c lick=\'s u b m itForm2()\'"    \'调用js函数上传
        End With