zoukankan      html  css  js  c++  java
  • 构造form表单

            public static string BuildFormHtml(SortedDictionary<string, string> sParaTemp, string gateway, string strMethod, string strButtonValue)
            {
    
    
                StringBuilder sbHtml = new StringBuilder();
    
                sbHtml.Append("<form id='Buildform1' name='Buildform1' action='" + gateway + "' method='" + strMethod.ToLower().Trim() + "'>");
    
                foreach (KeyValuePair<string, string> temp in sParaTemp)
                {
                    sbHtml.Append("<input type='hidden' name='" + temp.Key + "' value='" + temp.Value + "'/>");
                }
    
                //submit按钮控件请不要含有name属性
                sbHtml.Append("<input type='submit' value='" + strButtonValue + "' style='display:none;'></form>");
    
                sbHtml.Append("<script>document.forms['Buildform1'].submit();</script>");
                return sbHtml.ToString();
            }
                //待请求参数数组
                SortedDictionary<string, string> dicPara = new SortedDictionary<string, string>();
                dicPara.Add("userName", userNo);
                string html = BuildFormHtml(dicPara, "passBackDo.aspx", "post", "下一步");
                Response.Write(html);

    如果这篇文章对您有帮助,您可以打赏我

    技术交流QQ群:15129679

  • 相关阅读:
    Math 和 Date
    GRID布局
    移动端项目布局类型
    媒体查询 + rem用法
    字符串
    ES5 中常见的数组常用方法
    数组的排序
    毕设制作:前端界面 2020-02-01
    阅读笔记十六——排序算法
    阅读笔记十五——阿里面试题
  • 原文地址:https://www.cnblogs.com/yeminglong/p/2645243.html
Copyright © 2011-2022 走看看