} else { input.style.display = 'none'; } select.combox = null; select.parentNode.replaceChild(input, select); input.combox = _combox; _combox.originEl = input; } } //创建输入框 var _span1 = document.createElement('p'); // var _txtbox1 = document.createElement('input'); _txtbox1.type = 'text'; _txtbox1.comboxType = 'input'; _txtbox1.setAttribute('autoComplete', 'off'); _txtbox1.className = 'combox_inputDiv'; //_txtbox1.style.width = _addUnit(this.originElPos.width - this.dropDownBtnWidth); var _displayValueFlag = true; for (var text in _combox.source) { if (_combox.source[text] == this.displayValue) { _txtbox1.value = text; _displayValueFlag = false; break; } } if (_displayValueFlag) { _txtbox1.value = this.displayValue; } _span1.appendChild(_txtbox1); var _btn1 = document.createElement('input'); _btn1.type = 'button'; //_btn1.style.height = _addUnit(this.originElPos.height); //_btn1.style.width = _addUnit(this.dropDownBtnWidth); _btn1.comboxType = 'btn'; _btn1.className = 'combox_dropDownBtn'; _btn1.value = ''; _span1.appendChild(_btn1); this.originEl.parentNode.insertBefore(_span1, this.originEl); // var _div1 = document.createElement("div"); _div1.style.visibility = 'hidden'; _div1.style.position = 'absolute'; _div1.style.zIndex = 999; //_div1.style.width = _addUnit(this.originElPos.width); _div1.id = 're_text'; _div1.style.top = _addUnit(this.originElPos.height + this.originElPos.top); _div1.style.left = _addUnit(this.originElPos.left); // var _div2 = document.createElement("div"); _div2.style.overflow = 'auto'; _div2.className = 'combox_dropDownDiv'; // _div1.innerHTML = ''; _div1.appendChild(_div2); document.body.appendChild(_div1); // _txtbox1._dropDownDiv = _div2; _txtbox1._dropDownContainer = _div1; _txtbox1._combox = this; _btn1._combox = this; _div1._combox = this; _div2._combox = this; // this.txtBox = _txtbox1; this._dropDownDiv = _div2; this._dropDownContainer = _div1; // _txtbox1.onclick = this._inputAreaClickEv; if (this.mouseDblClick) { _div1.ondblclick = this._dropDownAreaClickEv; } else { _div1.onclick = this._dropDownAreaClickEv; } _btn1.onclick = this._dropDownBtnClickEv; _div1.onmouseover = this._dropDownAreaMouseOverEv; _txtbox1.onkeydown = this._dropDownAreaKeyDownEv; _txtbox1.onkeyup = this._dropDownAreaKeyUpEv; _txtbox1.onblur = function(){ if (this.value.length > 0 && typeof(this._combox.source[this.value.toString()]) != 'undefined') { this._combox.selectedValue = this._combox.originEl.value = this._combox.source[this.value.toString()]; this._combox.selectedText = this.value; } else if (this._combox.allowAnyValue == true) { this._combox.selectedText = this._combox.selectedValue = this._combox.originEl.value = this.value; } } _txtbox1.onfocus = function(){ this.select(); } /* _div1.onkeydown = function() { _combox._dropDownAreaKeyDownEv; var curEv = document.all ? window.event : arguments[0]; _stopDefEv(curEv); } _div1.onkeyup = function() { _combox._dropDownAreaKeyUpEv; var curEv = document.all ? window.event : arguments[0]; _stopDefEv(curEv); }*/ } //获取select的options的数据源 combox.prototype.getOriginSelectOptionsSource = function(){ if (this.originEl.options && this.originEl.options.length) { var s = {}; for (var i = 0; i < this.originEl.options.length; i++) { var o = this.originEl.options[i]; s[o.text] = o.value; } this.source = s; //增加动态延时时间 /*if (this.originEl.options.length <= 500) { this.dynamicDelay = 200; } else if (this.originEl.options.length > 500 && this.originEl.options.length < 2000) { this.dynamicDelay = 200; } else { this.dynamicDelay = 200; }*/ } } //获取远程数据源 combox.prototype.getRemoteOptionSourceFromUrl = function(){ var _combox = this; _createAjax(this.remoteSourceUrl, function(res){ var r = eval(res); if (r.length) { var s = {}; for (var i = 0; i < r.length; i++) { var o = r[i].text; s[o] = r[i].value; if (r[i].selected) { _combox.selectedValue = _combox.originEl.value = r[i].value; _combox.selectedText = _combox.txtBox.value = r[i].text; } } _combox.source = s; } }); } combox.prototype.getRemoteOptionSourceReCall = function(res){ var r = eval(res); if (r.length) { var s = {}; for (var i = 0; i < r.length; i++) { var o = r[i].text; s[o] = r[i].value; } this.source = s; } } //showType:0为所有,1为筛选模式 combox.prototype.fillDropDownData = function(showType){ var _combox = this; //GC if (this.rows && this.rows.length) { this.rows.splice(0, this.rows.length); } this._dropDownDiv.innerHTML = ''; // if (this.filterMode == 0) { var filterSource = {}; if (this.txtBox.value == '' || (this.txtBox.value == this.pleaseSelect && this.selectedText == this.pleaseSelect) || showType == 0) { filterSource = this.source; } else { for (o in this.source) { switch (this.searchMode) { case 0://模糊不区分大小写 if (o.toLowerCase().indexOf(this.txtBox.value.toLowerCase()) >= 0) { filterSource[o] = this.source[o]; } break; case 1://前缀不区分大小写 if (o.toLowerCase().indexOf(this.txtBox.value.toLowerCase()) == 0) { filterSource[o] = this.source[o]; } break; } } } this.fillDropDownDataDetail(filterSource); } else if (this.filterMode == 1) { var url = this.remoteFilterUrl.replace(/~!value!~/g, this.txtBox.value); if (this.debug) { alert(url); } _createAjax(url, function(res){ var r = eval(res); var filterSource = {}; if (r.length) { var s = {}; for (var i = 0; i < r.length; i++) { var o = r[i].text; s[o] = r[i].value; } filterSource = s; _combox.fillDropDownDataDetail(filterSource); } }); } } combox.prototype.fillDropDownDataDetail = function(filterSource){ var rowList = []; var rowIdx = 0; //使用documentFragment替代频繁的dom操作,减少浏览器延时 var dfg = document.createDocumentFragment(); for (o in filterSource) { var _div1 = document.createElement('div'); if (this.txtBox.value && this.txtBox.value.length) { //由于正则表达式在遇到/,(这种情况有问题,所以 //var regx = new RegExp(this.txtBox.value, 'ig'); //_div1.innerHTML = o.replace(regx, '$&'); var s1 = this.txtBox.value; var s2 = s1.toLowerCase(); var s3 = o.toLowerCase(); var i1 = s3.indexOf(s2); var i2 = s1.length; var i3 = o.length; if (i1 > -1) { _div1.innerHTML = o.substr(0, i1) + '' + o.substr(i1, i2) + '' + o.substr(i1 + i2); } else { _div1.innerHTML = o; } //_div1.innerHTML = _div1.innerHTML = o.replace(this.txtBox.value, '' + this.txtBox.value + ''); } else { _div1.innerHTML = o; } _div1._text = o; _div1._val = filterSource[o]; _div1.rowIdx = rowIdx; _div1.comboxType = 'row'; _div1.style.whiteSpace = 'nowrap'; _addClass(_div1, 'combox_normal'); if (o == this.selectedText) { _addClass(_div1, 'combox_selected_row'); this.selectedIdx = rowIdx; } dfg.appendChild(_div1); rowList.push(_div1); rowIdx++; } this._dropDownDiv.appendChild(dfg); var contentHeight = 0; var rowMaxWidth = 0; for (var i = 0; i < rowList.length; i++) { contentHeight += rowList[i].offsetHeight; rowMaxWidth = rowList[i].offsetWidth > rowMaxWidth ? rowList[i].offsetWidth : rowMaxWidth; } this.rows = rowList; this.hoverIdx = -1; //计算内部高度,如果超过固定搞定,设置滚动条 if (contentHeight > this.dropDownDivMaxHeight) { this._dropDownDiv.style.height = _addUnit(this.dropDownDivMaxHeight); if (this._dropDownContainer.childNodes[0] && this._dropDownContainer.childNodes[0].tagName && this._dropDownContainer.childNodes[0].tagName.toLowerCase() == 'iframe') { this._dropDownContainer.childNodes[0].style.height = _addUnit(this.dropDownDivMaxHeight); } } else { this._dropDownDiv.style.height = 'auto'; if (this._dropDownContainer.childNodes[0] && this._dropDownContainer.childNodes[0].tagName && this._dropDownContainer.childNodes[0].tagName.toLowerCase() == 'iframe') { this._dropDownContainer.childNodes[0].style.height = _addUnit(this._dropDownDiv.clientHeight); } } if (this._dropDownDiv.clientWidth < this._dropDownDiv.scrollWidth) { this._dropDownDiv.style.width = _addUnit(this._dropDownDiv.scrollWidth + 20); this._dropDownContainer.childNodes[0].style.width = this._dropDownDiv.offsetWidth; } this._dropDownDiv.style.overflowX = 'hidden'; //打开下拉选择区 if (rowList.length) { this.expand(); } else { this.fold(); } } combox.prototype._dropDownAreaKeyDownEv = function(){ var _combox = this._combox; clearTimeout(_combox.timeout_filter); var curEl = document.all ? window.event.srcElement : arguments[0].target; var curEv = document.all ? window.event : arguments[0]; if (curEl.comboxType && curEl.comboxType == 'input') { var pressKey = document.all ? window.event.keyCode : arguments[0].keyCode; switch (pressKey) { case 38://up if (_combox.rows.length) { _combox.expand(); if (_combox.hoverIdx > 0) { _addOrReplaceClass(_combox.rows[_combox.hoverIdx], 'combox_hover', 'combox_normal'); _addOrReplaceClass(_combox.rows[--_combox.hoverIdx], 'combox_normal', 'combox_hover'); if (_combox.rows[_combox.hoverIdx].offsetTop < _combox._dropDownDiv.scrollTop) { _combox._dropDownDiv.scrollTop = _combox.rows[_combox.hoverIdx].offsetTop; } } else { _addOrReplaceClass(_combox.rows[0], 'combox_normal', 'combox_hover'); _combox.hoverIdx = 0; } } break; case 40://down if (_combox.rows.length) { _combox.expand(); if (_combox.hoverIdx >= -1 && _combox.hoverIdx < _combox.rows.length - 1) { if (_combox.hoverIdx > -1) { _addOrReplaceClass(_combox.rows[_combox.hoverIdx], 'combox_hover', 'combox_normal'); } _addOrReplaceClass(_combox.rows[++_combox.hoverIdx], 'combox_normal', 'combox_hover'); if (_combox.rows[_combox.hoverIdx].offsetTop + _combox.rows[_combox.hoverIdx].offsetHeight > _combox._dropDownDiv.scrollTop + _combox.dropDownDivMaxHeight) { _combox._dropDownDiv.scrollTop = _combox.rows[_combox.hoverIdx].offsetTop + _combox.rows[_combox.hoverIdx].offsetHeight - _combox.dropDownDivMaxHeight; } } else { _addOrReplaceClass(_combox.rows[_combox.rows.length - 1], 'combox_normal', 'combox_hover'); _combox.hoverIdx = _combox.rows.length - 1; } } break; case 33://page up if (_combox.rows.length) { _combox.expand(); if (_combox.hoverIdx > 0) { _addOrReplaceClass(_combox.rows[_combox.hoverIdx], 'combox_hover', 'combox_normal'); var h = 0; for (var i = _combox.hoverIdx; i > 0; i--) { h += _combox.rows[i].offsetHeight; if (h > _combox.dropDownDivMaxHeight) { _addOrReplaceClass(_combox.rows[i], 'combox_normal', 'combox_hover'); if ((_combox._dropDownDiv.scrollTop <= _combox.rows[_combox.hoverIdx].offsetTop) && (_combox._dropDownDiv.scrollTop >= _combox.rows[_combox.hoverIdx].offsetTop + _combox.rows[_combox.hoverIdx].offsetHeight - _combox.dropDownDivMaxHeight)) { _combox._dropDownDiv.scrollTop -= h - _combox.rows[i].offsetHeight; } else { _combox._dropDownDiv.scrollTop = _combox.rows[i].offsetTop; } _combox.hoverIdx = i; break; } if (i == 1) { _addOrReplaceClass(_combox.rows[0], 'combox_normal', 'combox_hover'); _combox.hoverIdx = 0; _combox._dropDownDiv.scrollTop = 0; } } } else { _addOrReplaceClass(_combox.rows[0], 'combox_normal', 'combox_hover'); _combox.hoverIdx = 0; } } break; case 34://page down if (_combox.rows.length) { _combox.expand(); if (_combox.hoverIdx == -1) { _addOrReplaceClass(_combox.rows[0], 'combox_normal', 'combox_hover'); _combox.hoverIdx = 0; } else if (_combox.hoverIdx > -1 && _combox.hoverIdx < _combox.rows.length - 1) { _addOrReplaceClass(_combox.rows[_combox.hoverIdx], 'combox_hover', 'combox_normal'); var h = 0; for (var i = _combox.hoverIdx; i < _combox.rows.length - 1; i++) { h += _combox.rows[i + 1].offsetHeight; if (h > _combox.dropDownDivMaxHeight) { _addOrReplaceClass(_combox.rows[i], 'combox_normal', 'combox_hover'); if ((_combox._dropDownDiv.scrollTop <= _combox.rows[_combox.hoverIdx].offsetTop) && (_combox._dropDownDiv.scrollTop >= _combox.rows[_combox.hoverIdx].offsetTop + _combox.rows[_combox.hoverIdx].offsetHeight - _combox.dropDownDivMaxHeight)) { _combox._dropDownDiv.scrollTop += h - _combox.rows[i].offsetHeight; } else { _combox._dropDownDiv.scrollTop = _combox.rows[i].offsetTop + _combox.rows[i].offsetHeight - _combox.dropDownDivMaxHeight; } _combox.hoverIdx = i; break; } if (i == _combox.rows.length - 2) { _combox.hoverIdx = _combox.rows.length - 1; _addOrReplaceClass(_combox.rows[_combox.rows.length - 1], 'combox_normal', 'combox_hover'); _combox._dropDownDiv.scrollTop = _combox._dropDownDiv.scrollHeight; } } } else { _addOrReplaceClass(_combox.rows[_combox.rows.length - 1], 'combox_normal', 'combox_hover'); _combox.hoverIdx = _combox.rows.length - 1; } } break; case 13://enter _preventDefaultEv(curEv); break; default: } } } jQuery.expr[':'].contains = function(a, i, m) { // return jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase()) == 0; return jQuery(a).text().toUpperCase()==m[3].toUpperCase(); }; jQuery.expr[':'].containlikes = function(a, i, m) { return jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase()) == 0; }; combox.prototype._dropDownAreaKeyUpEv = function(){ var _combox = this._combox; clearTimeout(_combox.timeout_filter); var curEl = document.all ? window.event.srcElement : arguments[0].target; var curEv = document.all ? window.event : arguments[0]; if (curEl.comboxType && curEl.comboxType == 'input') { var pressKey = document.all ? window.event.keyCode : arguments[0].keyCode; switch (pressKey) { case 37://left break; case 38://up break; case 39://right break; case 40://down break; case 13://enter if (_combox.hoverIdx > -1) { //fix快速敲打键盘,造成选中的值与输入的值不一致情况 if (!_combox.flagFiltering) { _combox.selectedText = _combox.txtBox.value = _combox.rows[_combox.hoverIdx]._text; _combox.selectedValue = _combox.rows[_combox.hoverIdx]._val; // _combox.changeSelectedRowClass(); // if (_combox.originEl.value != _combox.rows[_combox.hoverIdx]._val) { _combox.originEl.value = _combox.rows[_combox.hoverIdx]._val; if (typeof(_combox.originEl.onchange) == 'function') { _combox.originEl.onchange(); } } } } _combox.fold(); _stopDefEv(curEv); if(_combox.journal){ var a=$("#comboxJournal option:contains('"+$(".combox_inputDiv").val()+"')"); if(a.length&&!a.attr("selected")){ $("#comboxJournal").val(a.val()); $("#comboxJournal").change(); }else if(a.length==0){ a=$("#comboxJournal option:containlikes('"+$(".combox_inputDiv").val()+"')"); if(a.length&&!a.attr("selected")){ $("#comboxJournal").val(a.val()); $("#comboxJournal").change(); } } } break; case 27://esc if (_combox.isFolded()) { _combox.expand(); } else { _combox.fold(); } break; case 33://page up break; case 34://page down break; /*case 16://shift 好烦躁的shift,有的人会用shift+字母输入。。。 break;*/ case 17://ctrl break; case 18://alt break; case 45://insert break; case 20://cap lock break; case 144://num lock break; case 32://space if (curEv.ctrlKey) { break; } default: if (_combox._previousText != curEl.value || _combox.flagFiltering) { _combox.flagFiltering = true; _combox.timeout_filter = setTimeout(function(){ curEl._combox.fillDropDownData(1); _combox.flagFiltering = false; }, _combox.dynamicDelay); _combox._previousText = curEl.value; } else if (!_combox.txtBox.value.length) { _combox.flagFiltering = true; _combox.timeout_filter = setTimeout(function(){ curEl._combox.fillDropDownData(0); _combox.flagFiltering = false; }, _combox.dynamicDelay); _combox._previousText = curEl.value; } } } } combox.prototype.changeSelectedRowClass = function(){ var _combox = this; if (_combox.selectedIdx > -1 && _combox.selectedIdx != _combox.hoverIdx) { _removeClass(_combox.rows[_combox.selectedIdx], 'combox_selected_row'); _addClass(_combox.rows[_combox.hoverIdx], 'combox_selected_row'); _combox.selectedIdx = _combox.hoverIdx; } } combox.prototype._dropDownAreaMouseOverEv = function(){ var _combox = this._combox; var curEl = document.all ? window.event.srcElement : arguments[0].target; if (curEl.comboxType && curEl.comboxType == 'row') { if (_combox.hoverIdx > -1 && _combox.hoverIdx != curEl.rowIdx) { _addOrReplaceClass(_combox.rows[_combox.hoverIdx], 'combox_hover', 'combox_normal'); _combox.hoverIdx = curEl.rowIdx; } else { _combox.hoverIdx = curEl.rowIdx; } _addOrReplaceClass(curEl, 'combox_normal', 'combox_hover'); } else if (curEl.tagName && curEl.tagName.toLowerCase() == 'span' && curEl.parentNode.comboxType && curEl.parentNode.comboxType == 'row') { if (_combox.hoverIdx > -1 && _combox.hoverIdx != curEl.parentNode.rowIdx) { _addOrReplaceClass(_combox.rows[_combox.hoverIdx], 'combox_hover', 'combox_normal'); _combox.hoverIdx = curEl.parentNode.rowIdx; } else { _combox.hoverIdx = curEl.parentNode.rowIdx; } _addOrReplaceClass(curEl.parentNode, 'combox_normal', 'combox_hover'); } var curEv = document.all ? window.event : arguments[0]; _stopDefEv(curEv); } combox.prototype._dropDownAreaClickEv = function(){ var _combox = this._combox; var curEl = document.all ? window.event.srcElement : arguments[0].target; if (curEl.comboxType && curEl.comboxType == 'row') { if (_combox.originEl.value != curEl._val) { _combox.selectedValue = _combox.originEl.value = curEl._val; if (typeof(_combox.originEl.onchange) == 'function') { _combox.originEl.onchange(); } _combox.selectedText = _combox.txtBox.value = curEl._text; _combox.changeSelectedRowClass(); } _combox.fold(); } else if (curEl.tagName && curEl.tagName.toLowerCase() == 'span' && curEl.parentNode.comboxType && curEl.parentNode.comboxType == 'row') { if (_combox.originEl.value != curEl.parentNode._val) { _combox.selectedValue = _combox.originEl.value = curEl.parentNode._val; if (typeof(_combox.originEl.onchange) == 'function') { _combox.originEl.onchange(); } _combox.selectedText = _combox.txtBox.value = curEl.parentNode._text; _combox.changeSelectedRowClass(); } _combox.fold(); } var curEv = document.all ? window.event : arguments[0]; _stopDefEv(curEv); } combox.prototype._dropDownBtnClickEv = function(){ var _combox = this._combox; var curEl = document.all ? window.event.srcElement : arguments[0].target; if (curEl.comboxType && curEl.comboxType == 'btn') { if (_combox.isFolded()) { _combox.fillDropDownData(0); } else { _combox.fold(); } } var curEv = document.all ? window.event : arguments[0]; _stopDefEv(curEv); curEl.blur(); } combox.prototype._inputAreaClickEv = function(){ var _combox = this._combox; var curEl = document.all ? window.event.srcElement : arguments[0].target; //var re_height = $(this).scrollTop(); if (curEl.comboxType && curEl.comboxType == 'input') { if (_combox.isFolded()) { _combox.fillDropDownData(0); } } var curEv = document.all ? window.event : arguments[0]; _stopDefEv(curEv); //document.getElementById("re_text").style.top = re_height + 182 + "px"; //if ( re_height < 1) { // document.getElementById("re_text").style.top = re_height + 182 + "px"; //} //else { // document.getElementById("re_text").style.top = re_height + 182 + "px"; //} } combox.prototype.expand = function(){ this._dropDownContainer.style.visibility = 'visible'; } combox.prototype.fold = function(){ this._dropDownContainer.style.visibility = 'hidden'; /*if (this.txtBox.value.length > 0 && typeof(this.source[this.txtBox.value.toString()]) != 'undefined') { this.selectedValue = this.originEl.value = this.source[this.txtBox.value.toString()]; this.selectedText = this.txtBox.value; } else if (this.allowAnyValue == true) { this.selectedText = this.selectedValue = this.originEl.value = this.txtBox.value; } else { this.txtBox.value = this.selectedText; }*/ } combox.prototype.isFolded = function(){ return this._dropDownContainer.style.visibility == 'hidden'; } combox.prototype.setValue = function(value){ if (value.length > 0 && typeof(this.source[value.toString()]) != 'undefined') { this.selectedValue = this.originEl.value = this.source[value]; this.txtBox.value = this.selectedText = value; } else if (this.allowAnyValue == true) { this.txtBox.value = this.selectedText = this.selectedValue = this.originEl.value = value; } } function _stopDefEv(ev){ if (document.all) { ev.cancelBubble = true; ev.returnValue = false; } else { ev.stopPropagation(); ev.preventDefault(); } } function _preventDefaultEv(ev){ if (document.all) { ev.returnValue = false; } else { ev.preventDefault(); } } function _addEv(el, ev, fn){ if (document.all) { el.attachEvent('on' + ev, fn); } else { el.addEventListener(ev, fn, false); } } function _hasCss(el, className){ try{ var cssAry = el.className.split(/\s/); for (var i = 0, css; css = cssAry[i]; i++) { if (className.toLowerCase() == css.toLowerCase()) { return true; } }}catch(e){} return false; } function _addClass(el, className){ try{ var a1 = el.className.split(/\s/); var a2 = []; for (var i = 0; i < a1.length; i++) { if (a1[i] != '' && a1[i].length) { a2.push(a1[i]); } } a2.push(className); el.className = a2.join(' '); }catch(e){} } function _removeClass(el, className){ try{ var a1 = el.className.split(/\s/); var a2 = []; for (var i = 0; i < a1.length; i++) { if (a1[i] != '' && a1[i].length && a1[i] != className) { a2.push(a1[i]); } } el.className = a2.join(' '); }catch(E){} } function _addOrReplaceClass(el, sourceClass, replaceClass){ try{ var a1 = el.className.split(/\s/); var a2 = []; for (var i = 0; i < a1.length; i++) { if (a1[i] != '' && a1[i].length && a1[i] != sourceClass) { a2.push(a1[i]); } } a2.push(replaceClass); el.className = a2.join(' '); }catch(e){ } } /* * 格式化<>等html标记,暂时不存在该问题 */ function _formatHTML(str){ return str.replace(//g, '>'); } function _createAjax(url, reCallFn){ var request; if (window.XMLHttpRequest) { request = new XMLHttpRequest(); if (request.overrideMimeType) { request.overrideMimeType('text/xml'); } } else if (window.ActiveXObject) { try { request = new ActiveXObject('Msxml2.XMLHTTP'); } catch (e) { try { request = new ActiveXObject('Microsoft.XMLHTTP'); } catch (e) { return false; } } } if (!request) { window.alert(".创建对象实例失败"); return false; } request.onreadystatechange = function(){ if (request.readyState == 4) { if (request.status == 200) { reCallFn(request.responseText); } } } request.open('get', url, true); request.send(null); } //获取元素的位置 function _getPos(el){ var _el = el; var t = _el.offsetTop; var l = _el.offsetLeft; var w = _el.offsetWidth; var h = _el.offsetHeight; while (_el = _el.offsetParent) { t += _el.offsetTop; l += _el.offsetLeft; } return { top: t, left: l, width: w, height: h }; } //悲剧,只能修复window.onresize时候,动态调整combox的绝对定位 _addEv(window, 'resize', function(){ if (window._combox && window._combox.length) { for (var i = 0; i < window._combox.length; i++) { var c = window._combox[i]; var pos = _getPos(c.txtBox); c._dropDownContainer.style.top = _addUnit(pos.top + pos.height); c._dropDownContainer.style.left = _addUnit(pos.left); } } }); //实现与通过css加载combox,兼容以前做的那个combox _addEv(window, 'load', function(){ var sel_ary = document.getElementsByTagName('select'); var _a = []; for (var i = 0; i < sel_ary.length; i++) { if (!sel_ary[i].multiple && sel_ary[i].style.display != 'none') { if (_hasCss(sel_ary[i], 'combox')) { _a.push(sel_ary[i]); } } } for (var i = 0; i < _a.length; i++) { var conf = {}; var el = _a[i]; if (el.getAttribute('debug') == 'true') { conf.debug = true; } if (!isNaN(el.getAttribute('searchMode')) && el.getAttribute('searchMode') != '') { conf.searchMode = parseInt(el.getAttribute('searchMode')); } if (el.getAttribute('remoteFilterUrl')) { conf.remoteFilterUrl = el.getAttribute('remoteFilterUrl'); } if (el.getAttribute('allowAnyValue') == 'true') { conf.allowAnyValue = true; } if (el.getAttribute('displayValue')) { conf.displayValue = el.getAttribute('displayValue'); } if (el.getAttribute('pleaseSelect')) { conf.pleaseSelect = el.getAttribute('pleaseSelect'); } if (el.getAttribute('mouseDblClick') == 'true') { conf.mouseDblClick = true; } var o = new combox(el, conf); } if (_a.length) { _a.splice(0, _a.length); } }) function _addUnit(num){ return num + 'px'; } var common_url = { 'changeJournal' : 'journal/changeJournalJX?journalID=', 'accessFailed' : 'accessFailed', 'timeOut' : 'timeOut' }; /** * ajax 请求 * * @param url * @param param * @return */ function ajaxGetReq(url) { var result = ""; if (url.indexOf('?') >= 0) { url += '&timspan=' + new Date().getTime(); } else { url += '?timspan=' + new Date().getTime(); } $.ajax({ type : "GET", url : url, async : false, error : function(msg) { result = msg; }, success : function(msg) { if (msg == '5554') { location.href = common_url.timeOut; } else if (msg == '5555') { location.href = common_url.accessFailed; } else { result = msg; } } }); return result; } /** * ajax 请求 * * @param url * @param param * @return */ function ajaxPostReq(url, param) { var result = ""; if (url.indexOf('?') >= 0) { url += '&timspan=' + new Date().getTime(); } else { url += '?timspan=' + new Date().getTime(); } $.ajax({ type : "POST", url : url, async : false, data : param, error : function(msg) { result = msg; }, success : function(msg) { if (msg == '5554') { location.href = common_url.timeOut; } else if (msg == '5555') { location.href = common_url.accessFailed; } else { result = msg; } } }); return result; } function ajaxAsyncReq(url) { var result; $.ajax({ type : "POST", url : url, async : true, error : function(msg) { result = msg; }, success : function(msg) { result = msg; } }); return result; } /** * 格式[{"id":1,"name":"(center)","pid":0},{"id":2,"name":"(Fast * contribute)","pid":1}] */ function dTreeJSON(obj, parentTitle) { var dtree = $.parseJSON(obj); d.add(0, -1, parentTitle, 'javascript:;', ''); for (var i in dtree) { eval("d.add(" + dtree[i].id + "," + dtree[i].pid + ",'" + dtree[i].name.replace("'","\\'") + "','javascript:;','')"); } return d; } /** * 格式[{"id":1,"name":"(center)","pid":0},{"id":2,"name":"(Fast * contribute)","pid":1}] */ function dTreeJSONs(obj, id, strId) { var dtree = $.parseJSON(obj); id.add(0, -1, 'All List', 'javascript:;', ''); for (var i in dtree) { id.add(dtree[i].id, dtree[i].pid, dtree[i].name, 'javascript:;', ''); } return id; } // 提示消息 function showMsg() { $("#msg").show(500); setTimeout("$('#msg').hide(500)", 1500); } // 点击弹出 function showDiv(show_div, bg_div) { var bg_div = "fade"; document.getElementById(show_div).style.display = 'block'; document.getElementById(bg_div).style.display = 'block'; $("#fade").append(''); $("#fade").attr("style","float:left;width:100%;display:block;position:absolute;left:0;top:0;height:" + $(document).height() + "px"); $(".sui_b").attr("style", "display:none;"); $("div[class^='white_content']").css({ top : $(window).height() / 2 + $(window).scrollTop() - $('#' + show_div).height() / 2 + 'px', left : ($(document).width() / 2 - $('#' + show_div).width() / 2) + 'px' }); }; // 关闭弹出层 function closeDiv(show_div) { var bg_div = "fade"; document.getElementById(show_div).style.display = 'none'; document.getElementById(bg_div).style.display = 'none'; $(".sui_b").attr("style", "display:block;"); }; // 重写下拉框 (function($) { function hideOptions(speed) { if (speed.data) { speed = speed.data } if ($(document).data("nowselectoptions")) { $($(document).data("nowselectoptions")).slideUp(speed); $($(document).data("nowselectoptions")).prev("div") .removeClass("tag_select_open"); $(document).data("nowselectoptions", null); $(document).unbind("click", hideOptions); $(document).unbind("keyup", hideOptionsOnEscKey); } } function hideOptionsOnEscKey(e) { var myEvent = e || window.event; var keyCode = myEvent.keyCode; if (keyCode == 27) hideOptions(e.data); } function showOptions(speed) { $(document).bind("click", speed, hideOptions); $(document).bind("keyup", speed, hideOptionsOnEscKey); $($(document).data("nowselectoptions")).slideDown(speed); $($(document).data("nowselectoptions")).prev("div") .addClass("tag_select_open"); } $.fn.selectCss = function(_speed) { $(this).each(function() { var speed = _speed || "fast"; if ($(this).data("cssobj")) { $($(this).data("cssobj")).remove(); } $(this).hide(); var divselect = $("
").insertAfter(this) .addClass("tag_select"); $(this).data("cssobj", divselect); var divoptions = $("").insertAfter(divselect) .addClass("tag_options").hide(); divselect.click(function(e) { if ($($(document).data("nowselectoptions")).get(0) != $(this) .next("ul").get(0)) { hideOptions(speed); } if (!$(this).next("ul").is(":visible")) { e.stopPropagation(); $(document).data("nowselectoptions", $(this).next("ul")); showOptions(speed); } }); divselect.hover(function() { $(this).addClass("tag_select_hover"); }, function() { $(this).removeClass("tag_select_hover"); }); $(this).change(function() { $(this).nextAll("ul").children("li:eq(" + $(this)[0].selectedIndex + ")") .addClass("open_selected").siblings() .removeClass("open_selected"); $(this).next("div").html($(this).children("option:eq(" + $(this)[0].selectedIndex + ")").text()); }); $(this).children("option").each(function(i) { var lioption = $("
  • ").html($(this).text()).attr( "title", $(this).attr("title")).appendTo(divoptions); if ($(this).attr("selected")) { lioption.addClass("open_selected"); divselect.html($(this).text()); } lioption.data("option", this); lioption.click(function() { lioption.data("option").selected = true; $(lioption.data("option")).trigger("change", true) }); lioption.hover(function() { $(this).addClass("open_hover"); }, function() { $(this).removeClass("open_hover"); }); }); }); } })(jQuery); /* 隔行换色 */ $(document).ready(function() { $('.audit tr').addClass('odd'); $('tr:even').addClass('even'); // 通用列表 $('.outside_t tr').addClass('odd'); $('tr:even').addClass('even'); // 审稿信息中1-6个操作列表 $('.outside_t tr').addClass('odd'); $('tr:even').addClass('even'); //审稿信息中1-6个操作列表 /* 稿件处理纵向伸缩 */ $(".menuTitle").click(function() { $(this).next("div").slideToggle("normal") .siblings(".menuContent:hidden").slideUp("normal"); $(this).toggleClass("activeTitle"); }); $(".menuTitle2").click(function() { $(this).next("div").slideToggle("normal") .siblings(".menuContent:hidden").slideUp("normal"); $(this).toggleClass("activeTitle2"); }); $(".menuTitle3").click(function() { $(this).next("div").slideToggle("normal") .siblings(".menuContent3:hidden").slideUp("normal"); $(this).toggleClass("activeTitle3"); }); /* 切换功能 */ $("#switch_m").click(function() { $("#s_menu").show(); }); $("#switch_m").hover(function() { $("#s_menu").hide(); }); $("#switch_n").click(function() { $("#n_menu").show(); }); $("#switch_n").hover(function() { $("#n_menu").hide(); }); $("#switch_r").click(function() { $("#r_menu").show(); }); $("#switch_r").hover(function() { $("#r_menu").hide(); }); }); // 添加cookie function addCookie(objName, objValue, objHours) {// 添加cookie var str = objName + "=" + escape(objValue); if (objHours > 0) {// 为0时不设定过期时间,浏览器关闭时cookie自动消失 var date = new Date(); var ms = objHours * 3600 * 24; date.setTime(date.getTime() + ms); str += "; expires=" + date.toGMTString(); } document.cookie = str; } // 得到cookie function getCookie(objName) {// 获取指定名称的cookie的值 var arrStr = document.cookie.split("; "); for (var i = 0; i < arrStr.length; i++) { var temp = arrStr[i].split("="); if (temp[0] == objName) return unescape(temp[1]); } } // 删除cookie function delCookie(name) {// 为了删除指定名称的cookie,可以将其过期时间设定为一个过去的时间 var date = new Date(); date.setTime(date.getTime() - 10000); document.cookie = name + "=a; expires=" + date.toGMTString(); } $.fn.wordLimit = function(num) { this.each(function() { if (!num) { var copyThis = $(this.cloneNode(true)).hide().css({"position" : "absolute","width" : "auto","overflow" : "visible"}); $(this).after(copyThis); if (copyThis.width() > $(this).width()) { $(this).text($(this).text().substring(0,$(this).text().length - 4)+ "..."); copyThis.remove(); $(this).wordLimit(); } else { copyThis.remove(); return; } } else { var maxwidth = num; if ($(this).text().length > maxwidth) { $(this).text($(this).text().substring(0, maxwidth)+ "..."); } } }) } $(document).ready(function(){ $(".account tr td:even").each(function(){ $(this).attr("style","background:#f5f9ff;width:20%;text-align:right"); }); $(".account tr td:odd").each(function(){ $(this).attr("style","background:#fff;line-height:20px"); }); $(".mydiv tr td").attr("style","background:#fff;padding:2px 4px;"); $(".mydiv tr td.lxfs").attr("style","padding:2px 4px;background:#f5f5f5;"); var tpa = $(".nv3").position().left-865; var tpai = $(".nv3").position().left-875; $(".mydiv").attr("style","display:none;line-height:24px;background:url(images/lxfs.gif) no-repeat;padding:10px 5px 5px 5px;font-weight: bold;z-index:999;width:260px;height:151px;top:141px;*top:164px;_top:159px;position:absolute;right:"+tpa+"px;_right:"+tpai+"px"); $(".nv3").click(function(){ $(".mydiv").show(); }) $(".mydiv").mouseleave(function(){ $(".mydiv").hide(); }); $(window).resize(function(){ var tpa = $(".nv3").position().left-820; var tpai = $(".nv3").position().left-835; $(".mydiv").attr("style","display:none;line-height:24px;background:url(images/lxfs.gif) no-repeat;padding:10px 5px 5px 5px;font-weight: bold;z-index:999;width:260px;height:151px;top:141px;*top:164px;_top:159px;position:absolute;right:"+tpa+"px;_right:"+tpai+"px"); $(".nv3").click(function(){ $(".mydiv").show(); }) $(".mydiv").mouseleave(function(){ $(".mydiv").hide(); }); }); }) function formatJson(str){ str = str.replace(/\\/g, "\\\\"); str = str.replace(/(\n)/g,"\\n"); str = str.replace(/\"/g, "\\\""); str = str.replace(/%/g, "%25"); str = str.replace(/&/g, "%26"); return str; } //截取后缀名 function getFiletype(filename) { var extStart = filename.lastIndexOf(".")+1; return filename.substring(extStart,filename.length).toLowerCase(); } var fileSize = { "passFileSize0": "4", "passFileSize1": "20" }; var req_url = { 'showResearchFieldlistJX': '//papersubmission.hanspub.org/researchfield/showResearchFieldlistJX?valid=0&journalId=124', 'changeJournal': 'paper/showAddPaper?journalID=', 'findRepeatPaperJX': '//papersubmission.hanspub.org/paper/findRepeatPaperJX?paper.title=', 'doFileProgress': '//papersubmission.hanspub.org/paper/doFileProgress', 'addUserValidateJX': '//papersubmission.hanspub.org/users/addUserValidateJX', 'loginInJX': '//papersubmission.hanspub.org/loginInJX' }; var d = new dTree('d'); d.config.checkName = 'ck'; function showResearchField() { var dtree = $.parseJSON(ajaxGetReq(req_url.showResearchFieldlistJX)); d.add(0, -1, 'CSA', 'javascript:;', ''); var j = 1; for (var i in dtree) { d.add(dtree[i].id, dtree[i].pid, dtree[i].name, 'javascript:checkedResearchField(' + j + ',' + dtree[i].special + ',0);', dtree[i].special); j++ } var oHtml = "
    全部展开    全部关闭"; document.getElementById('systree0').innerHTML = oHtml + d; var ck = ''; if (ck != '') { var ids = ck.split(','); for (i = 0; i < ids.length; i++) { d.co(ids[i]).checked = true } } } function checkedResearchField(idNo, special, flag) { var spec = new Array(); var j = 0; $("input[name='ck']:checked").each(function() { var cid = $(this).attr('id').substr(2); var display = $('#sd' + cid).attr('title'); if (display != '' && display == 1) { spec[j] = cid; j++ } }); if (special == 1) { for (var d = 0; d < spec.length; d++) { if (spec[d] != idNo) { $('#cd' + spec[d]).attr('checked', false) } } } if (flag == 0) { $('#cd' + idNo).attr('checked', !$('#cd' + idNo).attr('checked')) } } $(document).ready(function() { if (window.parent != window) { window.parent.location.href = "//papersubmission.hanspub.org/paper/showAddPaper" } showResearchField(); $('#errors').css('display', 'none'); $("input[name='ck']").click(function() { var idNo = $(this).attr('id').substr(2); var special = $('#sd' + idNo).attr('title'); if (special == '') { special = 0 } checkedResearchField(idNo, special, 1) }); $("input[name='user']").click(function() { if (this.value == 0) { $('#login').css('display', 'none'); $('#sign').css('display', 'block') } else { $('#login').css('display', 'block'); $('#sign').css('display', 'none') } }); $("#menu").attr("style", "padding:0 0 29px 561px;*padding:0 0 0px 541px;float:inherit;"); $("#menu .nv3").attr("style", "float:left;width:85px;height:29px;line-height:29px;padding-left:40px;margin:0 0 0 8px;background: url(//papersubmission.hanspub.org/images/nhead_m.jpg) no-repeat;"); $("#menu .nv5").attr("style", "float:left;width:85px;height:29px;line-height:29px;padding-left:40px;margin:0 0 0 8px;background: url(//papersubmission.hanspub.org/images/nhead_m.jpg) no-repeat -125px 0;"); $("#menu .nv2").attr("style", "float:left;width:85px;height:29px;line-height:29px;padding-left:40px;margin:0 0 0 8px;background: url(//papersubmission.hanspub.org/images/nhead_m.jpg) no-repeat -125px 0;"); setTimeout("showCkUP()", 2000) }); function showCkUP() { var loginName = getCookie('loginName_'); var pwd = getCookie('pwd_'); if (loginName != undefined && pwd != undefined) { $('#loginName').attr('value', loginName); $('#password').attr('value', pwd); $('#oldUser').attr('checked', 'checked'); $('#login').css('display', 'block'); $('#sign').css('display', 'none') } } function valid_PicFormatPaper(picFile, index) { var fileNameFormat = 'doc,docx,pdf'; var imageFormat = 'rar,jpg,png,bmp'; var allowtype = fileNameFormat.split(','); var allowtype1 = imageFormat.split(','); if (index == 1) { var formateFile = getFiletype(picFile); if ($.inArray(formateFile, allowtype) == -1) { return false } else { return true } } if (index == 2) { var formateFile1 = getFiletype(picFile); if ($.inArray(formateFile1, allowtype1) == -1) { return false } else { return true } } } function checkAddPaper() { var domain = 'http://76.191.115.82:888/FileUpLoad?cb=http://papersubmission.scirp.org/IJMIS/iframeConvers.jsp'; var title = $("input[name='paper.title']"); var paperabstract = $("textarea[name='paper.paperAbstract']"); var keyWords = $("input[name='keyWords']"); var paperCount = $("select[name='paper.pageCount']").val(); var doc = $("#doc"); var doc2 = $("#doc2"); var ck = $("input[name='ck']:checked"); var user = $('input[name="user"]:checked').val(); var qq = $("#qq").val(); var weibo = $("#weibo").val(); var weixin = $("#weixin").val(); clearErrors(); if ($.trim(title.val()) == "") { showErrors("Paper title is required!"); title.focus(); return false } else if ($.trim(paperabstract.val()) == "") { showErrors("Paper abstract is required!"); paperabstract.focus(); return false } else if ($.trim(keyWords.val()) == "") { showErrors("Paper keywords is required!"); keyWords.focus(); return false } else if ($.trim(doc.val()) == "") { showErrors("Paper file path is required!"); doc.focus(); return false } else if (!valid_PicFormatPaper($.trim(doc.val()), 1) && $.trim(doc.val()) != "") { showErrors("Upload paper format is not correct!"); return false } else if ($.trim(doc2.val()) != "" && !valid_PicFormatPaper($.trim(doc2.val()), 2)) { showErrors("Upload picture format is not correct!"); return false } else if (ck.length <= 1) { showErrors("Paper research field is required!"); return false } else if ($("#fileError").val() != 0) { doc.focus(); return false } else if ($("#file2Error").val() != 0) { doc2.focus(); return false } if (user == 0) { var firstName = $('#firstName').val(); var lastName = $('#lastName').val(); var degree = $('#degree').val(); var email1 = $('#email1').val(); var aff1 = $('#aff1').val(); var tel1 = $('#tel1').val(); var countryId = $('#countryId').val(); var pwd = $('#pwd').val(); var pwdConfirm = $('#pwdConfirm').val(); if ($.trim(firstName) == "") { showErrors('FirstName is required!'); return false } else if ($.trim(lastName) == "") { showErrors('LastName is required!'); return false } else if ($.trim(degree) == "") { showErrors('Degree is required!'); return false } else if ($.trim(email1) == "") { showErrors('Email is required!'); return false } else if(!valid_email($.trim(email1))){ showErrors('Email is invalid!'); return false; } else if ($.trim(aff1) == "") { showErrors('Affiliation is required!'); return false } else if ($.trim(tel1) == "") { showErrors('Telephone is required!'); return false } else if($.trim(countryId)==""){showErrors('City is required!'); return false } else if ($.trim(pwd) == "") { showErrors('Password is required!'); return false } else if ($.trim(pwdConfirm) == "") { showErrors('Password Confirm is required!'); return false } showBoxMsg('Is a new user'); var jsonlist = 'jsonlist={"journalId":"124","qq":"'+qq+'","weibo":"'+weibo+'","weixin":"'+weixin+'","firstName":"' + formatJson(firstName) + '","lastName":"' + formatJson(lastName) + '","degree":"' + formatJson(degree) + '","email1":"' + formatJson(email1) + '","aff1":"' + formatJson(aff1) + '","tel1":"' + formatJson(tel1) + '","country":"' + formatJson(countryId) + '","password":"' + formatJson(pwd) + '","pwdConfirm":"' + formatJson(pwdConfirm) + '"}'; var result = $.parseJSON(ajaxPostReq(req_url.addUserValidateJX, jsonlist)); if (result[0] == "error") { for (var i = 0; i < result[1].length; i++) { showErrors(result[1][i]) } return false } else { if (!loginIn(result[1][0], result[1][1])) { return false } } } else if (user == 1) { var loginName = $('#loginName').val(); var password = $('#password').val(); if ($.trim(loginName) == "") { showErrors('LoginName is required!'); return false } else if ($.trim(password) == "") { showErrors('Password is required!'); return false } if (!loginIn($.trim(loginName), $.trim(password))) { return false } } showWait(); return true } function changeJournal(journalId) { window.location.href = "//papersubmission.hanspub.org/" + req_url.changeJournal + journalId } function checkRepeatPaper(currenttitle) { var title = $("input[name='paper.title']"); var result = ""; if ($.trim(title.val()) != "") { currenttitle = formatJson(currenttitle); result = ajaxGetReq(req_url.findRepeatPaperJX + currenttitle) } if (result != "") { $("#titleMessage").html(result); window.setTimeout(function() { title.focus() }, 0) } else if (result == "") { $("#titleMessage").html('') } } var finished = true; function showStatus() { finished = false; clearErrors(); $('#statusInfo').html(""); setTimeout('callback()', 1000); showWait() } function showWait() { document.getElementById("state").style.display = 'none'; document.getElementById("fade").style.display = 'block'; var wale = $(window).width() / 2 - 125; var wahe = $(document).height(); $("#fade").append(''); $("#wait").attr("style", "width:260px;display:block;top:" + $(window).height() / 2 + "px;left:" + wale + "px"); $("#fade").attr("style", "top:0;display:block;height:" + wahe + "px") } function callback() { if (finished) return; var jv = $.parseJSON(ajaxGetReq(req_url.doFileProgress)); if (jv[0] == 'error') { closeStatus(); return } $('#progressBar').css('display', 'block'); $('#progressBarItem').css('width', jv.percent + '%'); $('#progressBarItem').css('background-color', '#ff0000'); $('#proFont').text(jv.percent + '%'); var view = '已完百分比:' + jv.percent + '%
    已完成数:' + jv.length + '
    文件总长度:' + jv.totalLength + '
    传输速度:' + jv.velocity + '
    已传输的时间:' + jv.time + '
    估计总时间:' + jv.totalTime + '
    估计剩余时间:' + jv.timeLeft + '
    正在上传第几个:' + jv.fileNumber; if (parseInt(jv.totalLength) > fileSize.passFileSize0) { showErrors('The file is too large!'); finished = true; closeStatus() } if (jv.length == jv.totalLength) { finished = true } else { setTimeout('callback()', 1000) } } function clearErrors() { $('#errors').css('display', 'none'); $('#errors').html("") } function showErrors(error) { $('#errors').css('display', 'block'); $('#errors').html($('#errors').html() + '

    ' + error + '

    '); $("html,body").animate({ scrollTop: $("#errors").offset().top }, 1000) } function loginIn(login, pwd) { showBoxMsg('Login in user'); var jsonlist = 'jsonlist={"journalId":"124","loginName":"' + formatJson(login) + '","pwd":"' + formatJson(pwd) + '"}'; var result = $.parseJSON(ajaxPostReq(req_url.loginInJX, jsonlist)); if (result[0] == "error") { for (var i = 0; i < result[1].length; i++) { showErrors(result[1][i]) } return false } document.getElementById("fade").style.display = 'block'; var wale = $(window).width() / 2 - 125; var wahe = $(document).height() - $(window).height(); $("#fade").append(''); $("#wait").attr("style", "width:260px;display:block;top:" + $(window).height() / 2 + "px;left:" + wale + "px"); $("#fade").attr("style", "top:0;display:block;height:" + wahe + "px"); $('#accountType').css('display', 'none'); $('#login').css('display', 'none'); $('#sign').css('display', 'none'); $('#loginIn').css('display', 'block'); $('#acountIn').html(result[1][0]); addCookie('loginName_', login, 30); addCookie('pwd_', pwd, 30); return true } function showBoxMsg(msg) { $('#proFont').html('

    ' + msg + '

    '); $('#progressBar').hide() } function closeStatus() { $('#fade').hide(); $('#wait').hide(); $('#progressBarItem').css('width', '0%'); $('#proFont').text('0%') } function filesize(ele, i) { try { var fileMax = (ele.files[0].size / 1024 / 1024).toFixed(2); var filterMax = eval("fileSize.passFileSize" + i); var error = 'The file should be less than ' + filterMax + 'M'; if (parseFloat(fileMax) > parseFloat(filterMax)) { showFileError(i, error, 1) } else { showFileError(i, '', 0) } } catch(e) {} } function showFileError(i, error, val) { if (i == 1) { $("#file2Error").attr("value", val); $("#doc2Message").text(error) } else { $("#fileError").attr("value", val); $("#docMessage").text(error) } } function checkVlidateEmail(email){ if($.trim(email)==''){ alert('email不能为空!'); return false; } if(!valid_email($.trim(email))){ alert('email无效!'); return false; } } function valid_email(email) { var patten = new RegExp(/^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]+$/); return patten.test(email); }
    提交文章(* 为必填项)     在线投稿文章出现问题或有不方便的地方,请您提交文章至 service@hanspub.org
          


    Uploading. Please wait...

      1%