加入收藏 | 设为首页 | 会员中心 | 我要投稿 济源站长网 (https://www.0391zz.cn/)- 数据工具、数据仓库、行业智能、CDN、运营!
当前位置: 首页 > 综合聚焦 > 资源网站 > 资源 > 正文

html 提交表单,图片和文字一起提交,图片存入服务器,图片地址

发布时间:2020-12-24 17:37:39 所属栏目:资源 来源:网络整理
导读:html pre class="has" !DOCTYPE html head meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no,minimum-scale=1.0,maximum-scale=1.0" / meta charset="UTF-8"gt; titleTitle/title script src="https://ajax.aspnetcdn.

/**

  • Clears the form data. Takes the following actions on the form's input fields:
    • input text fields will have their 'value' property set to the empty string
    • select elements will have their 'selectedIndex' property set to -1
    • checkbox and radio inputs will have their 'checked' property set to false
    • inputs of type submit,button,reset,and hidden will not be effected
    • button elements will not be effected
      */
      $.fn.clearForm = function(includeHidden) {
      return this.each(function() {
      $('input,select,textarea',this).clearFields(includeHidden);
      });
      };

/**

  • Clears the selected form elements.
    */
    $.fn.clearFields = $.fn.clearInputs = function(includeHidden) {
    var re = /^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list
    return this.each(function() {
    var t = this.type,tag = this.tagName.toLowerCase();
    if (re.test(t) || tag == 'textarea') {
    this.value = '';
    }
    else if (t == 'checkbox' || t == 'radio') {
    this.checked = false;
    }
    else if (tag == 'select') {
    this.selectedIndex = -1;
    }
    else if (t == "file") {
    if (/MSIE/.test(navigator.userAgent)) {
    $(this).replaceWith($(this).clone(true));
    } else {
    $(this).val('');
    }
    }
    else if (includeHidden) {
    // includeHidden can be the value true,or it can be a selector string
    // indicating a special test; for example:
    // $('#myForm').clearForm('.special:hidden')
    // the above would clean hidden inputs that have the class of 'special'
    if ( (includeHidden === true && /hidden/.test(t)) ||
    (typeof includeHidden == 'string' && $(this).is(includeHidden)) ) {
    this.value = '';
    }
    }
    });
    };

/**

  • Resets the form data. Causes all form elements to be reset to their original value.
    */
    $.fn.resetForm = function() {
    return this.each(function() {
    // guard against an input with the name of 'reset'
    // note that IE reports the reset function as an 'object'
    if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) {
    this.reset();
    }
    });
    };

/**

  • Enables or disables any matching elements.
    */
    $.fn.enable = function(b) {
    if (b === undefined) {
    b = true;
    }
    return this.each(function() {
    this.disabled = !b;
    });
    };

/**

  • Checks/unchecks any matching checkboxes or radio buttons and
  • selects/deselects and matching option elements.
    */
    $.fn.selected = function(select) {
    if (select === undefined) {
    select = true;
    }
    return this.each(function() {
    var t = this.type;
    if (t == 'checkbox' || t == 'radio') {
    this.checked = select;
    }
    else if (this.tagName.toLowerCase() == 'option') {
    var $sel = $(this).parent('select');
    if (select && $sel[0] && $sel[0].type == 'select-one') {
    // deselect all other options
    $sel.find('option').selected(false);
    }
    this.selected = select;
    }
    });
    };

// expose debug var
$.fn.ajaxSubmit.debug = false;

// helper fn for console logging
function log() {
if (!$.fn.ajaxSubmit.debug) {
return;
}
var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
if (window.console && window.console.log) {
window.console.log(msg);
}
else if (window.opera && window.opera.postError) {
window.opera.postError(msg);
}
}

}));

(编辑:济源站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

推荐文章
    热点阅读