📄 c_sample100.htm
字号:
function f_trim(inputString) {
if (typeof inputString != 'string') { return inputString; }
var retValue = inputString;
var ch = retValue.substring(0, 1);
while (ch == ' ' || ch == '\r' || ch == '\n') {
retValue = retValue.substring(1, retValue.length);
ch = retValue.substring(0, 1);
}
ch = retValue.substring(retValue.length-1, retValue.length);
while (ch == ' ' || ch == '\r' || ch == '\n') {
retValue = retValue.substring(0, retValue.length-1);
ch = retValue.substring(retValue.length-1, retValue.length);
}
while (retValue.indexOf(' ') != -1) {
retValue = retValue.substring(0, retValue.indexOf(' ')) +
retValue.substring(retValue.indexOf(' ')+1, retValue.length);
}
return retValue;
}
function f_check() {
ls_title = document.post.ti.value;
ls_content = document.post.co.value;
document.post.ti.value=f_trim(ls_title);
document.post.co.value=f_trim(ls_content);
if(document.post.ti.value == document.post.ti1.value && document.post.co.value.length < 1)
{
alert("不允许发布空贴");
return false;
}
if(document.post.ti.value == '' || document.post.ti.value == null)
{
alert("标题不能为空");
return false;
}
if(document.post.co.value == '' || document.post.co.value == null)
{
alert("内容不能为空");
return false;
}
if(need_verify==10){
if(document.post.word1.value == '' || document.post.word1.value == null)
{
alert("验证码不能为空,请输入验证码");
return false;
}
}
document.post.str2.value = fr_as_js_tr();
return true;
}
url=f_escape(window.location.href);
function ResetReplyTitle(no, title) {
if(no == null||no == ""){
if(title == null || title == '')
title_src = '100个经典C语言程序,大家可以进来看看。';
else
title_src = title;
}
else{
title_src = title;
var s = title_src.indexOf(":");
title_src = title_src.substring(s+1,title.length);
}
document.forms('post').ti.value='回复 ' + no + ':' + title_src;
document.forms('post').ti1.value='回复 ' + no + ':' + title_src;
return true;
}
function h(obj,url){
obj.style.behavior='url(#default#homepage)';
obj.setHomePage(url);
}
function getLeftChars(varField,limit_len) {
var i = 0;
var counter = 0;
var cap = limit_len;
var j=0;
for (i = 0; i< varField.value.length; i++) {
if (varField.value.charCodeAt(i) > 127 || varField.value.charCodeAt(i) == 94) {
j=j+2;
}
else {
j=j+1
}
} //结束FOR循环
//var leftchars = cap - varField.value.length;
var leftchars = cap - j;
return (leftchars);
}
function onCharsChange(varField,a_str,a_limit) {
var leftChars = getLeftChars(varField,a_limit);
if ( leftChars >= 0) {
return true;
} else {
ls_str = a_str + "超过字数限制!";
window.alert(ls_str);
//var len = document.thform.ti.value.length + leftChars;
//document.login.message.value = document.login.ti.value.substring(0, len);
varField.value=""
return false;
}
}
function f_GoPage(form){
form.rs6.value = f_trim(form.rs6.value);
if(isNaN(form.rs6.value)|| form.rs6.value=="" || form.rs6.length==0){ alert('请输入一个数字或者不能为空!');return false; }
if(form.rs6.value > 2) {
form.pn.value = (2 - 1)*50
return true;
}
if(form.rs6.value <= 0) {form.pn.value = 0 ; return true;}
form.pn.value = (form.rs6.value - 1)*50
return true;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -