Foxtable(狐表)用户栏目专家坐堂 → 下面的代码如何写入自定义函数中?


  共有2422人关注过本帖树形打印复制链接

主题:下面的代码如何写入自定义函数中?

帅哥,在线噢!
有点蓝
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106801 积分:543206 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/12/4 16:40:00 [显示全部帖子]

'开始生成网页前面这一段建议就保留在httprequest好了。

各个case里的内容再放到函数里,函数里自己定义自己的【Dim wb As New weui】,然后都调用e.WriteString

比如logon函数
Dim e As RequestEventArgs = args(0)
Dim wb As New weui
    wb.AddPageTitle("","pageheader","个人应用系统","--夜 语--")
        'wb.AddPageFooter("","pf1","Copyright © 2008-2016 foxtable.com").AddLink("底部链接","http://www.foxtable.com")
        wb.AddPageFooter("","pf1","京")
        If e.PostValues.ContainsKey("username") AndAlso e.PostValues.ContainsKey("password")  Then '判断是否是验证失败后的重新登录
            wb.AddTopTips("","toptip1","用户名或密码错误!").msec = 2000 '如果用户通过登录按钮访问,则给用户一个2秒的提示.
        End If
        wb.AddForm("","form1","logon.htm")
        With wb.AddInputGroup("form1","ipg1")
            .AddInput("username","户名:","text")
            .AddInput("password","密码:","password")
        End With
        With wb.AddButtonGroup("form1","btg1",True)
            .Add("btn1", "登录", "submit")
        End With
e.WriteString(wb.Build)

…………………………
Select Case e.path
    Case "logon.htm" '登录页面
        Functions.Execute("logon",e)
    Case "exit.htm" '退出登录
        Functions.Execute("exit",e)
    Case "", "default.htm" '首页
        Functions.Execute("default",e)
End Select
‘这里最后一句必须去掉e.WriteString(wb.Build)

 回到顶部