以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  手机版如何根据出生日期计算年龄  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=110294)

--  作者:WUZHAN
--  发布时间:2017/11/30 15:16:00
--  手机版如何根据出生日期计算年龄
手机版如何根据出生日期计算年龄?参考http://www.foxtable.com/mobilehelp/这个案例后不自动计算,不知为何?请老师帮忙一下。
[此贴子已经被作者于2017/11/30 15:49:31编辑过]

--  作者:有点甜
--  发布时间:2017/11/30 15:50:00
--  

填写出生日期日期以后生成年龄?

 

Select Case e.Path
    Case "test.htm",""
        Dim wb As New WeUI
        wb.AddForm("","form1","addnew.htm")
        With wb.AddInputGroup("form1","ipg1","客户资料")
            .AddInput("姓名","姓名","Text") \'前一个"姓名"是ID,后一个"姓名"是标题
            .AddInput("日期","日期","date").attribute = "onchange=""var r = this.value.match(/^(\\d{1,4})(-|\\/)(\\d{1,2})\\2(\\d{1,2})$/);if(r==null) return;var d= new Date(r[1], r[3]-1, r[4]); if(d.getFullYear()==r[1]&&(d.getMonth()+1)==r[3]&&d.getDate()==r[4]){ var Y = new Date().getFullYear(); 年龄.value = Y-r[1];}"""
            .AddInput("年龄","年龄","number")
        End With
        With wb.AddButtonGroup("form1","btg1",True)
            .Add("btn1", "确定", "submit")
        End With
        e.WriteString(wb.Build)
End Select