表单中有如下方法:
function checksay()
{ var str1 = inputform.msg.value ;
if(str1.length<1){inputform.msg.focus();return false;}
if(IsBadWord(str1)){Warning();return false;}/*脏话过滤*/
if((str1==inputform.message.value)&&(str1==strMsg)&&(inputform.talkto.value==talkto)&&(tk2==talkto)&&(str1.substring(0,3)!="/c "))
{alert("发言内容不能重复2次以上!"); inputform.msg.focus(); return false;}
//if(!checkspeed(str1)) return false; /* 客户端避免刷屏的算法,如果需要请使用此行代码。*/
strMsg = inputform.message.value; addOne(str1);
inputform.message.value=inputform.msg.value; tk2 = talkto; talkto=inputform.talkto.value;
inputform.msg.value=''; inputform.msg.focus(); return true;
}
function checkspeed(str1)
{
if(parent.talkspeed == 0) return true ;
if(str1.substring(0,2)=="/c")return true;t2=(new Date()).getTime();
if(t2-t1<1000||(t2-t1)*parent.talkspeed<str1.length*1000){if(t3++>4)alert('性子不要那么急嘛!');return false;}
t1=t2; t3=0; return true;/* 2001/1/23 增加客户端限制发言速度功能,此法可有效对付刷屏! */
}
用Webbrowser加载该框架后,如何运行checkspeed(str1)这个脚本,使其返回值永远是true? HtmlDocument doc = this.webChat.Document.Window.Frames[4].Document;
//框架结构中该方法所在框架位置
IHTMLWindow2 win = (IHTMLWindow2)doc.Window.DomWindow;
string s = @"function checkspeed('str1'){return 'true'}";
win.execScript(s, "javascript");
}
这样效果好象不行
function checksay()
{ var str1 = inputform.msg.value ;
if(str1.length<1){inputform.msg.focus();return false;}
if(IsBadWord(str1)){Warning();return false;}/*脏话过滤*/
if((str1==inputform.message.value)&&(str1==strMsg)&&(inputform.talkto.value==talkto)&&(tk2==talkto)&&(str1.substring(0,3)!="/c "))
{alert("发言内容不能重复2次以上!"); inputform.msg.focus(); return false;}
//if(!checkspeed(str1)) return false; /* 客户端避免刷屏的算法,如果需要请使用此行代码。*/
strMsg = inputform.message.value; addOne(str1);
inputform.message.value=inputform.msg.value; tk2 = talkto; talkto=inputform.talkto.value;
inputform.msg.value=''; inputform.msg.focus(); return true;
}
function checkspeed(str1)
{
if(parent.talkspeed == 0) return true ;
if(str1.substring(0,2)=="/c")return true;t2=(new Date()).getTime();
if(t2-t1<1000||(t2-t1)*parent.talkspeed<str1.length*1000){if(t3++>4)alert('性子不要那么急嘛!');return false;}
t1=t2; t3=0; return true;/* 2001/1/23 增加客户端限制发言速度功能,此法可有效对付刷屏! */
}
用Webbrowser加载该框架后,如何运行checkspeed(str1)这个脚本,使其返回值永远是true? HtmlDocument doc = this.webChat.Document.Window.Frames[4].Document;
//框架结构中该方法所在框架位置
IHTMLWindow2 win = (IHTMLWindow2)doc.Window.DomWindow;
string s = @"function checkspeed('str1'){return 'true'}";
win.execScript(s, "javascript");
}
这样效果好象不行
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货