form表单提交数据

2018-06-18 04:28:14来源:未知 阅读 ()

新老客户大回馈,云服务器低至5折

js代码:

// form 跳转 gotourl//跳转的页面  options json格式参数
function FromGoTo(gotourl, options) {
    var inputhtml = "";
    for (var attr in options) {
        var inputname = attr;
        var inputvalue = options[attr];
        inputhtml += "<input style=\"visibility: hidden;\" type=\"text\" name=\"" + inputname + "\" value=\"" + inputvalue + "\" />"
    }

    var fromhtml = "<form id=\"subimtFromGoTo\" method=\"post\" action=\"" + gotourl + "\" style=\"display:none;\" target=\"_blank\">"
    + inputhtml
    "</form>";
    $("#subimtFromGoTo").remove();
    $("body").append(fromhtml);
    $("#subimtFromGoTo").submit();
}
function Preview() {
    var news_title = $("input#txtTitle").val().trim();
    var news_postdate = $("input#txtDate").val().trim();
    var news_content = CKEDITOR.instances["div_content"].getData().trim();
    var options={"title":news_title,"postdate":news_postdate,"content":news_content};
    var gotourl="http://" + window.location.host + "/BaseAdmin/PrevNews.aspx";
    FromGoTo(gotourl, options);
}

 

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:WebForm(一)——IIS服务器、开发方式和简单基础

下一篇:js调用本地程序