<HTML>
<HEAD>
<TITLE>HOSTS文件編輯器</TITLE>
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312">
<metahttp-equiv="Content-Language"content="zh-CN">
<HTA:APPLICATIONID="hostedit"
APPLICATIONNAME="hostedit"
BORDER="thick"
BORDERSTYLE="normal"
CAPTION="yes"
ICON="C:/WINDOWS/system32/rasphone.exe"
MAXIMIZEBUTTON="yes"
MINIMIZEBUTTON="yes"
SHOWINTASKBAR="yes"
SINGLEINSTANCE="yes"
SYSMENU="yes"
VERSION="1.0"
WINDOWSTATE="normal"/>
<scriptlanguage="JScript">
window.onerror=function()
{
window.alert("程序發生了未知錯誤,當前窗口將被關閉!");
window.close();
returntrue;
}
varwindowW=450;//窗體寬
varwindowH=200;//窗體高
varcanresize=false;//是否可以改變大小
varwindowW2=windowW;//編輯時窗體寬
varwindowH2=200;//編輯時窗體高
window.resizeTo(windowW,windowH);
//window.moveTo((screen.width-windowW)/2,(screen.height-windowH)/2);
window.onresize=function(){if(!canresize)window.resizeTo(windowW,windowH);}
functioninit()
{
varui_table=document.getElementById('UI_TABLE');
varbestHeight=70+ui_table.scrollHeight;
if(bestHeight>screen.height)bestHeight=screen.height;
window.resizeTo(windowW,bestHeight);
//window.moveTo((screen.width-windowW)/2,(screen.height-bestHeight)/2);
}
varhostfile='//drivers//etc//hosts';
functiongetlist(){
varhtml='';
varids='';
vari=1;
FSO=newActiveXObject("Scripting.FileSystemObject");
varspath=FSO.GetSpecialFolder(1)+hostfile;
host=FSO.OpenTextFile(spath,1,false);
while(!host.AtEndOfStream){
tmp=host.ReadLine();
if(/^#?/d{1,3}/./d{1,3}/./d{1,3}/./d{1,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))
{
as=tmp.replace(//s+/,'|:|').split('|:|');
ids+='['+i+'],';
if(/^/#/.test(as[0])){
zt='外網';