代码如下::
<Hta: Anwendung
Id = "mySampleHta"
Caption = "Ja"
Scroll = "auto"
Border = "keine"
BORDERSYLE = "statisch"
SingleInInstance = "Ja"
maximizeButton = "nein"
Border = "Nein"
icon = "dxdiag.exe">
<title> vpn 连接程序 hta 版 </title>
<Styles>
Körper
{
Schriftgröße: 12;
Hintergrund: #dadada;
Rand-Links: 5;
}
Eingang
{
Breite: 50;
Überlauf: sichtbar;
Rand: 1px feste hellblau;
Hintergrundfarbe: #ccccc;
Cursor: Text;
}
Taste
{
Grenze: 1px Festgrau;
Breite: 70;
Rand-Links: 2;
Cursor: Hand;
Schriftgröße: 12;
filter: progid: dimaTeTransform.microsoft.gradient (startColorStr = '#eaaff', EndColorStr = '#618fff', GradientType = '0');
}
</style>
<body>
<Eingabe id = "id" size = "30" value = "mjj"> </input> <br>
<Eingabe -ID = "Pass" size = "30" value = "mjj"> </input> <br>
<input id = "ip" size = "50" value = "vpn 的 ip"> </input> <br>
<button id = "OK" onclick = vbs: conn> 链接 </button>
<button id = "nok" onclick = vbs: dConn> 断开 </button>
<button id = "ipshow" onclick = vbs: show> 当前 ip 显示 </button>
<button id = "vpnshow" onclick = vbs: vpnshow> vpn 列表 </button>
<button id = "vpnhelp" Onclick = VBS: ShowHelp> 帮助 </button> <br>
<div id = "url"> </div>
</body>
<Script Language = "vbscript">
Setzen Sie oshell = createObject ("wscript.shell")
Sub window_onload
Fenster.Resizeto 450.380
Fenster.Moveto 300, 300
Kopie
Ende sub
Unterkopie
x ("ip"). value = me.clipboardData.getData ("Text")
SetTimeout "Kopie", 2000
Ende sub
Funktion X (OBJ)
Setzen Sie x = document.getElementById (OBJ)
Endfunktion
Sub dconn
cmd = oshell.exec ("rasdial /d"). stdout.readall ()
x ("URL"). Innerhtml = CMD
Ende sub
Untershow
x ("url"). innerHtml = "<br> <br> <iframe src = http: //www.ip138.com/ip2city.asp> </iframe>"
Ende sub
Sub conn
tempfile = "c:/tmp ~ 386"
Wenn findFile (tempfile) = false dann
writef tempfile, x ("ip"). Wert
x ("url"). innerHtml = "PBK -Datei erstellen ........ OK , 连接中"
Anders
writef tempfile, x ("ip"). Wert
x ("url"). Innerhtml = "PBK -Datei 存在 ........ OK , 连接中 连接中"
Ende wenn
x ("url"). Innerhtml = oshell.exec ("Rasdial Pvpn" & x ("ID"). Value & "" & x ("Pass"). Value & " /Telefonbuch:" & tempfile) .stdout.readall ()
Ende sub
Sub vpnshow
Setzen Sie fso = createObject ("scripting.filesystemObject").
Datei = "ip.txt"
Setzen Sie txt = fso.opentextFile (Datei)
Wenn nicht txt.atendofstream, dann '先确定还没有到达结尾的位置
Content = txt.readall '读取整个文件的数据
Linien = Ersetzen (Inhalt, vbcrlf, "<br>") '将文本内分行字符 vbcrlf 换成 html 换行标记 "<br>"
x ("URL"). Innerhtml = Zeilen
Ende wenn
Ende sub
Funktion findFile (str)
Setzen Sie fso = createObject ("scripting.filesystemObject").