/* [Discuz!] (C)2001-2099 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: threadsort.js 30962 2012-07-04 07:57:45Z zhangjie $ */ function xmlobj() { var obj = new Object(); obj.createXMLDoc = function(xmlstring) { var xmlobj = false; if(window.DOMParser && document.implementation && document.implementation.createDocument) { try{ var domparser = new DOMParser(); xmlobj = domparser.parseFromString(xmlstring, 'text/xml'); } catch(e) { } } else if(window.ActiveXObject) { var versions = ["MSXML2.DOMDocument.5.0", "MSXML2.DOMDocument.4.0", "MSXML2.DOMDocument.3.0", "MSXML2.DOMDocument", "Microsoft.XmlDom"]; for(var i=0; i'; for(var i in choicesarr) { nameid = ''; if((choicesarr[sselectchoiceoptionid]['slevel'] == 1 || type == 'search') && choicesarr[i]['scount'] == choicesarr[sselectchoiceoptionid]['scount']) { nameid = name + ' ' + id; } if(choicesarr[i]['sfoptionid'] != '0') { var patrn1 = new RegExp("^" + choicesarr[i]['sfoptionid'] + "\\.", 'i'); var patrn2 = new RegExp("^" + choicesarr[i]['sfoptionid'] + "$", 'i'); if(selectchoiceoptionid.match(patrn1) == null && selectchoiceoptionid.match(patrn2) == null) { continue; } } if(choicesarr[i]['scount'] != lastcount) { if(parseInt(choicesarr[i]['scount']) >= (parseInt(choicesarr[sselectchoiceoptionid]['scount']) + parseInt(choicesarr[sselectchoiceoptionid]['slevel']))) { break; } selectoption += '' + "\r\n" + ''; lastcount = parseInt(choicesarr[i]['scount']); } var patrn1 = new RegExp("^" + choicesarr[i]['soptionid'] + "\\.", 'i'); var patrn2 = new RegExp("^" + choicesarr[i]['soptionid'] + "$", 'i'); var isnext = ''; if(parseInt(choicesarr[i]['slevel']) != 1) { isnext = '»'; } if(selectchoiceoptionid.match(patrn1) != null || selectchoiceoptionid.match(patrn2) != null) { selectoption += "\r\n" + ''; } else { selectoption += "\r\n" + ''; } } selectoption += ''; if(type == 'search') { selectoption += "\r\n" + ''; } $('select_' + forum_optionlist[soptionid]['sidentifier']).innerHTML = selectoption; } function checkoption(identifier, required, checktype, checkmaxnum, checkminnum, checkmaxlength) { if(checktype != 'image' && checktype != 'select' && !$('typeoption_' + identifier) || !$('check' + identifier)) { return true; } var ce = $('check' + identifier); ce.innerHTML = ''; if(checktype == 'select') { if(required != '0' && ($('typeoption_' + identifier) == null || $('typeoption_' + identifier).value == '0')) { warning(ce, '必填项目没有填写'); return false; } else if(required == '0' && ($('typeoption_' + identifier) == null || $('typeoption_' + identifier).value == '0')) { ce.innerHTML = ' 请选择下一级'; ce.className = "warning"; return true; } } if(checktype == 'radio' || checktype == 'checkbox') { var nodes = $('typeoption_' + identifier).parentNode.parentNode.parentNode.getElementsByTagName('INPUT'); var nodechecked = false; for(var i=0; i'; } } if(checkvalue) { if(checktype == 'email' && !(/^[\-\.\w]+@[\.\-\w]+(\.\w+)+$/.test(checkvalue))) { warning(ce, '邮件地址不正确'); return false; } else if((checktype == 'text' || checktype == 'textarea') && checkmaxlength != '0' && mb_strlen(checkvalue) > checkmaxlength) { warning(ce, '填写项目长度过长'); return false; } else if((checktype == 'number' || checktype == 'range')) { if(isNaN(checkvalue)) { warning(ce, '数字填写不正确'); return false; } else if(checkmaxnum != '0' && parseInt(checkvalue) > parseInt(checkmaxnum)) { warning(ce, '大于设置最大值'); return false; } else if(checkminnum != '0' && parseInt(checkvalue) < parseInt(checkminnum)) { warning(ce, '小于设置最小值'); return false; } } else if(checktype == 'url' && !(/(http[s]?|ftp):\/\/[^\/\.]+?\..+\w[\/]?$/i.test(checkvalue))) { warning(ce, '请正确填写以http://开头的URL地址'); return false; } ce.innerHTML = ''; } return true; }