zoukankan      html  css  js  c++  java
  • form表单提交数据

    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);
    }
    
  • 相关阅读:
    The first appliaction for "Hello World!"
    zone
    learn to study
    深入理解 Angular 2 变化监测和 ngZone
    看看吧
    生命周期钩子
    一个简单的todo
    依赖注入
    @Output()
    @Input
  • 原文地址:https://www.cnblogs.com/zhyue93/p/form.html
Copyright © 2011-2022 走看看