文档hta编辑host文件脚本

host文件  时间:2021-02-27  阅读:()

★精品文档★hta编辑host文件脚本

代码如下:

<html

<head

<titlehosts文件编辑器</title

<meta http-equiv=content-type content=text/html ;charset=gb2312

<meta http-equiv=content-language content=zh-cn

<hta:appl ication id=hosteditappl icationname=hosteditborder=thickborderstyle=normalcaption=yesicon=c:\windows\system32\rasphone.exe maximizebutton=yesminimizebutton=yesshowintaskbar=yessingleinstance=yessysmenu=yesversion=1 .0windowstate=normal /

<script language=jscript

1/17

★精品文档★window.onerror=function ()

{

  window.alert(程序发生了未知错误当前窗口将被关闭 );

  window.close();

   return true;

}var windoww=450;  //窗体宽var windowh=200;  //窗体高var canresize=false;//是否可以改变大小var windoww2=windoww;//编辑时窗体宽var windowh2=200;//编辑时窗体高window.resizeto(windoww,windowh);

//window.moveto((screen.width-windoww)/2,(screen.height-windowh)/2);window.onresize=function(){if(!canresize)window.resizeto(windoww,windowh);}function init()

{

    var ui_table =2/17

★精品文档★document.getelementbyid(‘ui_table’);

    var bestheight =70+ui_table.scrol lheight;

    if(bestheight screen.height)bestheight=screen.height;

  window.resizeto(windoww,bestheight);

   //window.moveto((screen.width-windoww)/2,(screen.height-bestheight)/2);

}var hostfi le=‘\\drivers\\etc\\hosts’ ;function getl ist(){

  var html=‘ ‘ ;

  var ids=‘ ‘ ;

  var i=1 ;

    fso = newactivexobject(scripting.fi lesystemobject);

    var spath =fso.getspecia lfolder(1)+hostfi ,3}\s+([a-za-z0-9\-]+\.[a-za-z0-9\-]+(\.(com|net|org|edu| info|biz|cc|tv|gov|mobi |name|cn|en|us|hk|tw))+)$/.test(tmp))

     {

3/17

★精品文档★

       as=tmp.replace(/\s+/, ’ | : | ’).spl it(‘ | : | ’);

  &nb       co =‘#eee! important’ ;

            cz =‘<a href=# style=color:red; oncl ick=zh(‘+i+’ ,0);切本地</a|<a href=#style=color:red;oncl ick=ed(this, ’+i+’);编辑</a|<a href=#style=color:red;oncl ick=zh(‘+i+’ ,2);删除</a’ ;

     }else{

       zt= ‘本地’ ;

       ip=as[0];

            co =‘#fff! important’ ;

            cz =‘<a href=#oncl ick=zh(‘+i+’ ,1);切外网</a |<a href=#style=color:red; oncl ick=ed(this, ‘+i+’);编辑</a | <ahref=# style=color:red; oncl ick=zh(‘+i+’ ,2);删除</a’ ;  

     }

       html +=

4/17

★精品文档★

‘<tr<td style=background: ’+co+’ ; ’+zt+’</td<tdstyle=background: ’+co+’ ;text-al ign: left;text-indent:6px; ’+as

[1]+’</td<tdstyle=text-al ign: left;text-indent:6px;background: ’+co+’ ; ’+ip+’</td<td style=background: ’+co+’ ; ’+cz+’</td</tr’ ;

     }

     i++;

   }

  var o=document.getelementbyid(‘ ids’);

  o.value=ids;

   host.close();

   return html ;

}function ed(eo, i id){  

   document.getelementbyid(‘editid’).value=i id;

   document.getelementbyid(‘pip’).value=eo.parentelement.parentelement.chi ldren[2]. innertext;

   document.getelementbyid(‘purl’).value=eo.parentelement.parentelement.chi ldren[1]. innertext;

5/17

★精品文档★

   document.getelementbyid(‘addbutt’).style.display=‘none’ ;

   document.getelementbyid(‘editbutt’).style.display=‘ inl ine’ ;

   document.getelementbyid(‘hostl ist’).style.display=‘none’ ;

   document.getelementbyid(‘addhost’).style.display=‘block’ ;d{1 ,3}\.\d{1 ,3}\.\d{1 ,3}$/.test(oi .value)==false) {

    alert(‘ ip地址不能为空或你输入的ip格式错误. ’);

    oi .focus();

     return;

   }

    if(ou.valuesp;      return;

   }

    var i id =document.getelementbyid(‘editid’).value;

  var body=‘ ‘ ;

  var i=1 ;

    fso = new

6/17

★精品文档★activexobject(scripting.fi lesystemobject);

    var spath =fso.getspecialfolder(1)+hostfi le;  

   host=fso.opentextfi le(spath, 1 , false);

  whi le(!host.atendofstream){

     tmp=host.readl ine();

     if(i==i id)

     {

           body+=oi .value+\t+ou.value+\n;

     }

    else{

           body+=tmp+\n;

     }

     i++;

   }

   host.close();

&n bsp;&n bsp;svf=fso.opentextfi le(spath,2, false);

  svf.write(body);

  svf.close();

  window. location.reload();

7/17

★精品文档★

}function zh(irs,stype)

{

  var body=‘ ‘ ;

  var i=1 ;

    fso = newactivexobject(scripting.fi lesystemobject);

    var spath =fso.getspecialfolder(1)+hostfi le;  

   host=fso.opentextfi le(spath, 1 , false);

  whi le(!host.atendofstream){

     tmp=host.readl ine();

   body+=tmp+\n;

         }else{

          body+=‘#’+tmp+\n;

         }

       }else{

       }

     }

8/17

★精品文档★

    else{

           body+=tmp+\n;

     }

     i++;

   }

   host.close();

&n bsp;&n bsp;svf=fso.opentextfi le(spath,2, false);

  svf.write(body);

  svf.close();

  window. location.reload();

}function zhal l(stype)

{

  var body=‘ ‘ ;

  var i=1 ;

    varids1=document.getelementbyid(ids).value;

   if(ids1==‘ ‘) return;

    fso = newactivexobject(scripting.fi lesystemobject);

    var spath =

9/17

新加坡云服务器 1核2Gg 46元/月 香港云服务器 1核2G 74元/月 LightNode

LightNode是一家成立于2002年,总部位于香港的VPS服务商。提供基于KVM虚拟化技术.支持CentOS、Ubuntu或者Windows等操作系统。公司名:厦门靠谱云股份有限公司官方网站:https://www.lightnode.com拥有高质量香港CN2 GIA与东南亚节点(河内、曼谷、迪拜等)。最低月付7.71美金,按时付费,可随时取消。灵活满足开发建站、游戏应用、外贸电商等需求。首...

创梦网络-新上雅安电信200G防护值内死扛,无视CC攻击,E5 32核高配/32G内存/1TB SSD/100Mbps独享物理机,原价1299,年未上新促销6折,仅779.4/月,续费同价

创梦网络怎么样,创梦网络公司位于四川省达州市,属于四川本地企业,资质齐全,IDC/ISP均有,从创梦网络这边租的服务器均可以****,属于一手资源,高防机柜、大带宽、高防IP业务,另外创梦网络近期还会上线四川眉山联通、广东优化线路高防机柜,CN2专线相关业务。广东电信大带宽近期可以预约机柜了,成都优化线路,机柜租用、服务器云服务器租用,适合建站做游戏,不须要在套CDN,全国访问快,直连省骨干,大网...

IMIDC日本多IP服务器$88/月起,E3-123x/16GB/512G SSD/30M带宽

IMIDC是一家香港本土运营商,商家名为彩虹数据(Rainbow Cloud),全线产品自营,自有IP网络资源等,提供的产品包括VPS主机、独立服务器、站群独立服务器等,数据中心区域包括香港、日本、台湾、美国和南非等地机房,CN2网络直连到中国大陆。目前主机商针对日本独立服务器做促销活动,而且提供/28 IPv4,国内直连带宽优惠后每月仅88美元起。JP Multiple IP Customize...

host文件为你推荐
外网和内网什么是内网,和外网有什么区别雅虎社区有什么网站的论坛内容丰富 资讯较新 适合年轻人的?打开网页出现错误我打开网页老出现错误是怎么了?二叉树遍历怎么正确理解二叉树的遍历arm开发板新手入门应如何选择 ARM 开发板?硬盘人克隆一个人需要多少人多长时间啊雅虎天盾雅虎天盾、瑞星杀毒软件、瑞星防火墙、卡卡上网安全助手能同时使用吗?小米3大概多少钱小米3现在多少钱人人逛街过节了,这儿可真热闹写一段话人人逛街人人逛街网是正品吗
泛域名解析 l5639 realvnc parseerror 免费全能空间 linux空间 韩国名字大全 中国网通测速 国外免费asp空间 台湾google 国外在线代理服务器 万网空间 cdn网站加速 深圳域名 工信部icp备案查询 群英网络 阿里云邮箱个人版 建站论坛 卡巴下载 日本小学生 更多