function sax_getbyid(id) { itm = null; if (document.getElementById) { itm = document.getElementById(id); } else if (document.all) { itm = document.all[id]; } else if (document.layers) { itm = document.layers[id]; } return itm; } function copytburl(obj){ var rng = document.body.createTextRange(); rng.moveToElementText(obj); rng.scrollIntoView(); rng.select(); rng.execCommand("Copy"); rng.collapse(false); alert("该地址已经复制到剪切板"); } function ctlent(event) { if((event.ctrlKey && event.keyCode == 13) || (event.altKey && event.keyCode == 83)) { sax_getbyid("submit").click(); } } function addquote(obj,strAuthor){ var text = sax_getbyid(obj).innerHTML; text = text.replace(/alt\=(\"|)([^\"\s]*)(\"|)/g,"> $2 <"); text = text.replace(/\<[^\<\>]+\>/g,"\n"); text = text.replace(/ +/g," "); text = text.replace(/\n+/g,"\n"); text = text.replace(/^\n*/gm,""); text = text.replace(/^\s*/gm,""); text = text.replace(/\n*$/gm,""); text = text.replace(/\s*$/gm,""); text = text.replace(/</g,"<"); text = text.replace(/>/g,">"); text = text.replace(/  /g," "); text = text.replace(/&/g,"&"); sax_getbyid("content").value += "[quote="+strAuthor+"]"+text+"[/quote]"; sax_getbyid("content").focus(); } function checkform() { if (sax_getbyid('comment_name')) { if (sax_getbyid('comment_name').value == "") { alert("请输入您的名字."); return false; } } /* if (sax_getbyid('url').value == "") { alert("请输入主页地址."); return false; }*/ if (sax_getbyid('email').value == "") { alert("请输入邮件地址."); return false; } if (sax_getbyid('content').value == "") { alert("请输入内容."); return false; } var reg=/.*[\u4E00-\u9FA5]+.*$/; if (!sax_getbyid('content').value.match(reg)) { alert("内容必须包含汉字"); return false; } if (((postminchars != 0 && sax_getbyid('content').value.length < postminchars) || (postmaxchars != 0 && sax_getbyid('content').value.length > postmaxchars))) { alert("您的评论内容长度不符合要求。\n\n当前长度: "+sax_getbyid('content').value.length+" 字节\n系统限制: "+postminchars+" 到 "+postmaxchars+" 字节"); return false; } sax_getbyid('submit').disabled = true; return true; } function checkloginform() { if (sax_getbyid('username')) { if (sax_getbyid('username').value == "") { alert("请输入您的名字."); return false; } } if (sax_getbyid('password')) { if (sax_getbyid('password').value == "") { alert("请输入密码."); return false; } } if (sax_getbyid('confirmpassword')) { if (sax_getbyid('confirmpassword').value == "") { alert("请输入确认密码."); return false; } } return true; } function showhide(obj) { var fh = sax_getbyid(obj); fh.className == "divON" ? fh.className = "divOFF" : fh.className = "divON"; } function copyurl(url){ var clipBoardContent=document.location.href; window.clipboardData.setData("Text",clipBoardContent); }