📄 zhishinew.js
字号:
dg.event(msg, click_ok, click_no, click_no); $("dialogOk").value="继续提交"; $("dialogCancel").value="我要修改";}function _set_id_focus(idname){ if (idname != "") { try {$(idname).focus();}catch (e){} }}function get_icon(icons){ var icon = 'login_wrong'; return icon;}function openWindow(_sUrl, _sWidth, _sHeight, _sTitle, _sScroll, ok){ if (ok == null && document.readyState != "complete") { setTimeout(function(){openWindow( _sUrl, _sWidth, _sHeight, _sTitle, _sScroll, 1);},500); return false; } var oEdit = new dialog(); oEdit.init('yes'); oEdit.set('title', _sTitle ? _sTitle : "系统提示信息" ); oEdit.set('width', _sWidth); oEdit.set('height', _sHeight); oEdit.set('auto', 'n'); oEdit.open(_sUrl, _sScroll != "yes" ? 'no' : 'yes');}function getFrameNode(sNode){ return document.frames ? document.frames[sNode] : document.getElementById(sNode).contentWindow;}function strLen(key){ var l=escape(key),len len=l.length-(l.length-l.replace(/\%u/g,"u").length)*4 l=l.replace(/\%u/g,"uu") len=len-(l.length-l.replace(/\%/g,"").length)*2 return len}function zsxz(ta, zs, maxl){ var l = ta.value.length;//.replace(/[^\x00-\xff]/gi,'xx') if(l > maxl) { ta.value = ta.value.substring(0,maxl); } else { zs.value = maxl - l; }}//处理浏览器,用来选择不同的XML读取函数var agt = navigator.userAgent.toLowerCase();var is_opera = (agt.indexOf("opera") != -1);var is_ie = (agt.indexOf("msie") != -1) && document.all && !is_opera;var is_ie5 = (agt.indexOf("msie 5") != -1) && document.all;var uniqnum_counter = (new Date).getTime();var is_regexp = (window.RegExp) ? true : false;var xmlhttp = null;function UniqueNum() { ++uniqnum_counter; return uniqnum_counter;}//创建Get请求function StartGETRequest(url, handler){ xmlhttp = null; if (is_ie) { var control = (is_ie5) ? "Microsoft.XMLHTTP" : "Msxml2.XMLHTTP"; try { xmlhttp = new ActiveXObject(control); } catch(e) { alert("You need to enable active scripting and activeX controls"); DumpException(e); } } else { xmlhttp = new XMLHttpRequest(); } xmlhttp.onreadystatechange = function() {handler();} if (url.indexOf("?") != -1){ var urltemp = url + "&rand=" + UniqueNum(); } else { var urltemp = url + "?rand=" + UniqueNum(); } //alert(urltemp); xmlhttp.open('GET', urltemp, true); xmlhttp.send(null); }//创建POST请求function StartPOSTRequest(url, data, handler){ xmlhttp = null; if (is_ie) { var control = (is_ie5) ? "Microsoft.XMLHTTP" : "Msxml2.XMLHTTP"; try { xmlhttp = new ActiveXObject(control); } catch(e) { alert("You need to enable active scripting and activeX controls"); DumpException(e); } } else { xmlhttp = new XMLHttpRequest(); } xmlhttp.onreadystatechange = function() {handler();} xmlhttp.open('POST', url, true); if (typeof(xmlhttp.setRequestHeader) != "undefined") { xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; Charset=GB2312'); } xmlhttp.send(data); }//处理方法function GetObjValue(objName){ if(document.getElementById){ return eval('document.getElementById("' + objName + '")'); }else{ return eval('document.all.' + objName); }}function fetchObject(idname){ if (document.getElementById) { return document.getElementById(idname); } else if (document.all) { return document.all[idname]; } else if (document.layers) { return document.layers[idname]; } else { return null; }}// function to emulate document.getElementsByTagNamefunction fetchTags(parentobj, tag){ if (typeof parentobj.getElementsByTagName != 'undefined') { return parentobj.getElementsByTagName(tag); } else if (parentobj.all && parentobj.all.tags) { return parentobj.all.tags(tag); } else { return null; }}function fetchXmlValue(parentobj, tag){ try{ var tags = fetchTags(parentobj, tag); return tags[0].firstChild.nodeValue; } catch(e) { return null; }}function checkpic(this_form){ var fso,f; if (this_form.upload_file.value.length > 0){ var filesize = 1; try { fso=new ActiveXObject("Scripting.FileSystemObject"); f = fso.GetFile(this_form.upload_file.value); filesize = f.size; } catch (e1) {} if (filesize >200000 || filesize == 0) { _error_msg_show("文件不能为空,并且小于200K"); return false; } } return true;}function checkForm(this_form){ if ((this_form.answer.value == '') || (this_form.answer.value.length > 20000)) { _error_msg_show("回答的内容长度必须为1-10000个汉字!"); this_form.answer.focus(); return false; } if (this_form.referto.value.length > 120) { _error_msg_show("对不起,参考文献内容长度不能大于60个汉字!"); this_form.referto.focus(); return false; } return true;}function showSending() { document.getElementById("sending").style.visibility="visible"; document.getElementById("cover").style.visibility="visible";}function on(tdbg){ tdbg.style.background="#fff17d";}function off(tdbg){ tdbg.style.background="#EFF7FE";}function checkLogin(){if (document.login.U_Loginname.value==""){_error_msg_show("会员名不能为空,请输入会员名!");document.login.U_Loginname.focus();return false;}if (document.login.U_Pass.value==""){_error_msg_show("密码不能为空,请输入密码!");document.login.U_Pass.focus();return false;}return true;}function getCommentHtmlList(qid, aid){ var strText; var fError = false; if (xmlhttp.readyState == 4){ if (xmlhttp.status == 200){ strText = fetchXmlValue(xmlhttp.responseXML, 'body'); if (null == strText) { fError = true; } else { fetchObject("commentsec" + qid + aid).innerHTML = strText; } }else{ fError = true; } } if (fError) { fetchObject("commentsec" + qid + aid).innerHTML = ""; fetchObject("comment" + qid + aid).style.display = "none"; } else { fetchObject("comment" + qid + aid).scrollIntoView(true); }}function submitComment(qid, aid){ var strText; var fnServerError = DisplayPostCommentError(qid, aid); if (xmlhttp.readyState == 4){ if (xmlhttp.status == 200){ var res = fetchXmlValue(xmlhttp.responseXML, 'result'); strText = fetchXmlValue(xmlhttp.responseXML, 'body'); if (null == strText) { fnServerError(); } else { if (res.toLowerCase() == 'ok') { var t_total = fetchXmlValue(xmlhttp.responseXML, 'total'); fetchObject("commenttotal" + qid + aid).innerHTML = t_total; fetchObject("commentsec" + qid + aid).innerHTML = strText; } else { fetchObject("Err" + qid + aid).innerHTML = "<div><img src='http://www.sinaimg.cn/pfp/ask/images/zhishi/error_icon.gif' width=15 height=16 border=0>"+ strText +"</div>"; } } }else{ fnServerError(); } }}function OpenSection(qid, aid, pages){ var sectionTitleObj = fetchObject("comment" + qid + aid); var sectionDescObj = fetchObject("commentsec" + qid + aid); if (sectionTitleObj.style.display == 'none' || sectionTitleObj.style.display == '') { sectionTitleObj.style.display = "block"; } try{ if (fetchObject("commentimg" + qid + aid).src == "http://www.sinaimg.cn/pfp/i/z2/z2_zz_fbpl_da1.gif") { if (pages == null) { fetchObject("commentimg" + qid + aid).src = "http://www.sinaimg.cn/pfp/i/z2/z2_zz_fbpl_da2.gif"; Close(qid, aid, pages); return ; } } else { fetchObject("commentimg" + qid + aid).src = "http://www.sinaimg.cn/pfp/i/z2/z2_zz_fbpl_da1.gif"; } }catch(e){}; if (pages==null && sectionDescObj.style.display == "block") { Close(qid, aid, pages); return ; } if (sectionDescObj.style.display == "none") { sectionDescObj.style.display = 'block'; } var strA = "questionid="+ qid; strA += "&answerid=" + aid; if (pages >= 0) strA += "&pages=" + pages; StartGETRequest('/browse/zhishi_request_comment.php?'+strA, function() {getCommentHtmlList(qid, aid)});}function Close(qid, aid, pages){ try{ fetchObject("commentimg" + qid + aid).src = "http://www.sinaimg.cn/pfp/i/z2/z2_zz_fbpl_da2.gif"; }catch(e){}; fetchObject("commentsec" + qid + aid).style.display = "none";}function CloseComment(qid, aid){ if (fetchObject("err"+ qid + aid) != null) { fetchObject("Err"+qid + aid).innerHTML = ""; fetchObject("txtComment"+qid + aid).value = ""; } Close(qid, aid);}function DisplayPostCommentError(qid, aid){ return function(){ document.getElementById("Err"+qid+aid).innerHTML = "<div><img src='http://www.sinaimg.cn/pfp/ask/images/zhishi/error_icon.gif' width=15 height=16 border=0>服务器出现问题,请重试。</div>"; }}function PostComment(qid, aid){ var strComment = fetchObject("txtComment"+qid + aid); var strError = ""; nCommentLength = strComment.value.length; if (nCommentLength == 0 || nCommentLength > 200 ) { if (strError.length == 0) { strComment.focus(); } } if (nCommentLength == 0) { strError = "<div><img src='http://www.sinaimg.cn/pfp/ask/images/zhishi/error_icon.gif' width=15 height=16 border=0>评论不能为空,请输入评论。</div>"; } else if (nCommentLength > 200) { strError = "<div><img src='http://www.sinaimg.cn/pfp/ask/images/zhishi/error_icon.gif' width=15 height=16 border=0>评论太长,请缩短您的评论。</div>"; } if (strError.length > 0) { document.getElementById("Err" + qid + aid).innerHTML = strError; return false; } if (window.RegExp && window.encodeURIComponent) { var newStrComment = encodeURIComponent(strComment.value); } else { var newStrComment = strComment.value; } var strA = "questionid="+ qid; strA += "&answerid=" + aid; strA += "&do=add"; strA += "&answer_flag=5"; strA += "&txtcomment="+newStrComment; StartGETRequest('/browse/zhishi_request_comment.php?'+strA, function() {submitComment(qid, aid)});}<!--function iask_submit(fn,strName){ if(strName == "ask") { fn.action = "http://iask.sina.com.cn/question/ask_new_2.php"; fn.title.value = fn.key.value; fn.key.value = ''; fn.submit(); return false; } else if(strName == "know") { if(fn.key.value == "" || fn.key.value == "请输入查询词" || fn.key.value == "请输入问题标题") { fn.key.value = "请输入查询词"; fn.key.focus(); return false; } fn.action = "http://iask.sina.com.cn/search_engine/search_knowledge_engine.php"; fn.submit(); return false; } else { return false; }}function ckwords(obj){ if(obj.value == "请输入查询词" || obj.value == "请输入问题标题") { obj.value = ""; obj.focus(); return false; }}function swapPic(_sId,_sAttr,_sTxt1, _sTxt2) { $(_sId)[_sAttr] = $(_sId)[_sAttr].indexOf(_sTxt1) > -1 ? _sTxt2 : _sTxt1;}//--><!--function getClassify () { return window.document.classify;}function setSize (w, h) { getClassify ().width = w; getClassify ().height = h;}//-->function setClassifyObj (type, bgcolor, classid, args) { var size = args.split ("|"); var query = "sw=" + size[0] + "&wi=" + size[1] + "&hi=" + size[2] + "&t=" + type + "&id=" + classid; var uri = "http://www.sinaimg.cn/pfp/iask/zsr/classify.swf?"; var clo = '<object style="z-index: -1;" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" id="classify" width="406" height="77" align="middle">' + '<param name="allowScriptAccess" value="always" />' + '<param name="movie" value="'+ uri +'?' + query + '" />' + '<param name="quality" value="high" />' + '<param name="bgcolor" value="' + bgcolor + '" />' + ' <embed src="'+ uri + query + '" quality="high" bgcolor="'+ bgcolor +'" swLiveConnect=true id="classify" name="classify" width="406" height="77" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />' + '</object>' document.write (clo);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -