www.gusucode.com > HadSky PHP轻论坛系统源码 v2.4.2源码程序 > ytqlt_v2.4.2.0701/template/mb1/js/puyuetian.js
// JavaScript Document function trim(str) { return str.replace(/(^\s*)|(\s*$)/g, ""); } //javascript去掉空格函数 function Cxmlhttp() { //xmlhttp组件创建 try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlhttp = false; } } if (!xmlhttp && typeof XMLHttpRequest != 'undefined') { xmlhttp = new XMLHttpRequest(); } return xmlhttp; } function addfavor() { try { window.external.addFavorite(document.URL, document.title); } catch (e) { alert('添加收藏失败,请使用Ctrl+D进行添加'); } } function Ding(type, id) { xmlhttp = Cxmlhttp(); xmlhttp.open('GET', 'index.php?c=ding&type=' + type + '&id=' + id + '&rnd=' + Math.random()); xmlhttp.send(null); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { result = xmlhttp.responseText; if (result == 'True') { switch (type) { case 'qiandao': document.getElementById('qiandaodiv').style.backgroundPositionY = '-100px'; document.getElementById("userjifen").innerHTML = parseInt(document.getElementById("userjifen").innerHTML) + qiandaojifen; document.getElementById("usertiandou").innerHTML = parseInt(document.getElementById("usertiandou").innerHTML) + qiandaotiandou; document.getElementById("qiandaodays").innerHTML = parseInt(document.getElementById("qiandaodays").innerHTML) + 1; break; case 'read': document.getElementById("zanread").innerHTML = parseInt(document.getElementById("zanread").innerHTML) + 1; break; } } } } } function readsorta(v) { form_post.title.value = v; document.getElementById("readsortdiv").style.visibility = 'hidden'; } function readsortdiv(c) { if ($readsort != '') { if (trim(form_post.title.value) == '') { document.getElementById("readsortdiv").style.visibility = c; } } } function readsortdivhidden() { document.getElementById("readsortdiv").style.visibility = 'hidden'; }