如何让网页内的某个函数不起作用

怎么让网页内的某个函数不起作用?某网站起始登录页面源码如下;HTML code!DOCTYPE html PUBLIC -//W3C//D

怎么让网页内的某个函数不起作用?
某网站起始登录页面源码如下;

HTML code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>某某单位信息门户系统</title><style type="text/css"><!--body {    margin-left: 0px;    margin-top: 0px;    margin-right: 0px;    margin-bottom: 0px;    background-color: #2f93de;    background-repeat: no-repeat;    height:100%;}.inputA {    background-attachment: scroll;    background-Image: url('none');    font-size: 12px;    font-weight: lighter;}form, html{    height:100%;    }.table_main {    background-attachment: scroll;    background-repeat: repeat-x;    background-position: center center;}--></style><script language="JavaScript" type="text/javascript">function addCookie(objName,objValue,objHours){//添加cookievar str = objName + "=" + escape(objValue);if(objHours > 0){//为0时不设定过期时间,浏览器关闭时cookie自动消失var date = new Date();var ms = objHours*3600*1000;date.setTime(date.getTime() + ms);str += "; expires=" + date.toGMTString();}document.cookie = str;}function getCookie(objName){//获取指定名称的cookie的值var arrStr = document.cookie.split("; ");for(var i = 0;i < arrStr.length;i ++){var temp = arrStr[i].split("=");if(temp[0] == objName) return unescape(temp[1]);}}function delCookie(name){//为了删除指定名称的cookie,可以将其过期时间设定为一个过去的时间var date = new Date();date.setTime(date.getTime() - 10000);document.cookie = name + "=a; expires=" + date.toGMTString();}function openUrl(){var wWidth = screen.availWidth-10;var wHeight= screen.availHeight-35;window.open(window.location,'','top=0,left=0,width='+wWidth+',height='+wHeight+',resizable=yes,scrollbars=yes');}if(getCookie('target')){}else{addCookie('target','first',0);openUrl();window.opener=null;window.open('','_self');window.close();}</script><script language="JavaScript" type="text/javascript"><!--    function doAs(){        document.all.username.focus();    }    function checkForm(){  if(document.forms[0].username.value){      if(document.forms[0].username.value=='qianjinjie'){          document.forms[0].username.value='qianjinjie1'      }  }    var retCode;  if ( document.forms[0].username.value ) {    if ( document.forms[0].password.value )      retCode = true;    else {       alert ("请输入密码!");      retCode = false;      document.forms[0].password.focus();      return;    }  }  else {    retCode = false;    if ( document.forms[0].password.value )    {       alert ("请输入用户名!");       document.forms[0].username.focus();       return;    }    else    {      alert ("请输入用户名和密码!");      document.forms[0].username.focus();      return;    }  }         return retCode;  }function checkError()   {       if(document.forms[0].error.value.length>1)      {         alert('您输入的用户名或密码有误,请重新输入。');         document.forms[0].error.value="";      }      doAs();  }//--></script></head><body leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" onload="checkError();" background="http://148.16.23.4:81/images/BG.gif"><script language="JavaScript" type="text/javascript">var warningString = "<B>WARNING:</B> To maintain your login session, make sure that your browser is configured to accept Cookies.";document.cookie = 'acceptsCookies=yes';if(document.cookie == ''){document.write(warningString);}else{document.cookie = 'acceptsCookies=yes; expires=Fri, 13-Apr-1970 00:00:00 GMT';}</script><noscript><b>WARNING:</b> To maintain your login session, make sure that<br />your browser is configured to accept Cookies.</noscript><!--- END Cookie check block ---><form action="./pkmslogin.form" method="post" name="form1" id="form1" onsubmit='if(!checkForm())return false;'>  <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" class="table_main" background="http://148.16.23.4:81/images/BG.gif">    <tr>      <td height="100%" align="center" valign="middle"><table width="760" border="0" cellspacing="0" cellpadding="0">          <tr>            <td height="33" colspan="3" background="http://148.16.23.4:81/images/01.gif"><a style="cursor: hand" onclick="window.open('http://148.16.16.78:7001/eyou/guest.jsp')" > <span style="font-size:13px;color:#EBCF86;font-family:Arial;cursor:hand" >              <marquee  direction= "left"  scrolldelay="10" scrollamount="3" onmouseover="this.stop()" onmouseout="this.start()">              您的建议是我们进步的原动力,请马上联系我们hbdsxxb@hbds.gov.cn。有奖哦!              </marquee>            </span></a></td>          </tr>          <tr>            <td width="14" rowspan="3" background="http://148.16.23.4:81/images/02-1.gif"></td>            <td><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="734" height="361">                <param name="movie" value="http://148.16.23.4:81/images/load_BIG.swf" />                <param name="quality" value="high" />                <embed src="http://148.16.23.4:81/images/load_BIG.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="734" height="361"></embed>              </object></td>            <td width="12" rowspan="3" background="http://148.16.23.4:81/images/02-2.gif"></td>          </tr>          <tr>            <td height="75" align="left" background="http://148.16.23.4:81/images/title.jpg"><table width="250" border="0" cellspacing="0" cellpadding="0">                <tr>                  <td width="25"></td>                  <td width="207"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="79" height="59">                      <param name="movie" value="http://148.16.23.4:81/images/1.swf" />                      <param name="quality" value="high"/>                      <param  name="wmode" value="transparent" />                      <embed src="http://148.16.23.4:81/images/1.swf"   pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="79" height="59"></embed>                    </object></td>                  <td></td>                </tr>              </table></td>          </tr>          <tr>            <td height="66" align="center" background="http://148.16.23.4:81/images/title_bg.gif"><table width="100%" border="0" cellpadding="0" cellspacing="0">                <tr>                  <td width="50" valign="middle"></td>                  <td width="47" valign="middle"><img src="http://148.16.23.4:81/images/ID.gif" width="47" height="18"/></td>                  <td valign="middle"><input name="username" type="text" size="20" style="width:132;height:10" tabindex="1" />                    &nbsp;&nbsp; </td>                  <td width="41" valign="middle"><img src="http://148.16.23.4:81/images/pw.gif" width="47" height="18" /></td>                  <td valign="middle"><input type="password" name="password" size="20" style="width:132;height:10" tabindex="2" />                    &nbsp;&nbsp; </td>                  <td width="10" valign="middle">&nbsp;</td>                  <td width="80" align="center" valign="middle"><input type="image" src="http://148.16.23.4:81/images/load.gif" width="57" height="18" /></td>                  <td width="80" align="center" valign="middle"><a href="javascript:form1.reset()"><img src="http://148.16.23.4:81/images/repeat.gif" width="57" height="18" border="0" /></a></td>                  <td width="50" valign="middle"><input type="submit" value="Login" style="width:0;height:0;display:none" />                    <input type="hidden" name="login-form-type" value="pwd" />                    <input type="hidden" name="error" value="" /></td>                </tr>              </table></td>          </tr>          <tr>            <td height="15" colspan="3" background="http://148.16.23.4:81/images/03.gif"></td>          </tr>          <tr>            <td colspan="3" height="20" bgcolor="#2f93de"><span style="font-size:11px;color:#ffffff;font-family:Arial">技术支持电话</tr>        </table></td>    </tr>  </table></form></body></html><script language="JavaScript" type="text/javascript">function checkLocation(){  if(window.location!="http://pt.ds.hb/"){  window.location="http://pt.ds.hb/";}}window.setTimeout("checkLocation()", 100);</script> 


现在因为加上了<script language="JavaScript" type="text/javascript">
function checkLocation(){
if(window.location!="http://pt.ds.hb/"){
window.location="http://pt.ds.hb/";
}
}
window.setTimeout("checkLocation()", 100);
</script>这一个函数而造成WebBrowser不能打开,打开的语他只会另开一个IE的窗口,怎么让其不加载其页面最后一个函数呢?

[解决办法]
try:
VB code
Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)    WebBrowser1.Document.parentWindow.execScript "checkLocation=null;"End Sub
[解决办法]
只要不是页面调入时执行,则可写一个空的同名函数脚本覆盖,语法跟创建其它HTML标签一样。
[解决办法]
VB code
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)    Dim doc As HTMLDocument, objScript As HTMLScriptElement        If pDisp Is Me.WebBrowser1.Object Then        Set doc = Me.WebBrowser1.document        Set objScript = doc.createElement("script")        objScript.Type = "text/javascript"        objScript.Text = "function checkLocation(){}" + vbCrLf        doc.appendChild objScript    End IfEnd Sub