Menu

[r181]: / phprpc_2.1 / sample / telnet.html  Maximize  Restore  History

Download this file

96 lines (93 with data), 3.4 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<html>
<head>
<style type="text/css">
body, input, textarea {
font-size: 12px;
}
</style>
<script type="text/javascript" src="../js/compressed/full/phprpc_client.js"></script>
<script type="text/javascript">
phprpc_client.create('telnet', true);
telnet.use_service('http://test.coolcode.cn/phprpc_2.1/sample/phprpc.net/telnet.aspx');
telnet.encrypt = 2;
function updateContent(str) {
var content = document.getElementById("content");
if (str == null) {
}
else if (str.constructor == phprpc_error) {
alert(str.errstr);
}
else {
content.value = content.value + str;
}
content.scrollTop = content.scrollHeight;
}
window.onload = function () {
document.getElementById("login").onclick = function () {
var hostname = document.getElementById("hostname").value;
var port = parseInt(document.getElementById("port").value);
var codepage = document.getElementById("codepage").value;
telnet.Connect(hostname, port, codepage, function (result) {
if (result == null) {
alert("µÇ¼ʧ°Ü£¡");
}
else if (result.constructor == phprpc_error) {
alert(result.errstr);
}
else {
updateContent(result);
document.getElementById("hostname").disabled = true;
document.getElementById("port").disabled = true;
document.getElementById("codepage").disabled = true;
document.getElementById("login").disabled = true;
document.getElementById("command").focus();
}
});
return false;
}
document.getElementById("command").onkeypress = function(event) {
if (window.event) event = window.event;
if (event.keyCode == 13) {
var command = document.getElementById("command");
telnet.DoCommand(command.value, function (result) {
command.value = "";
updateContent(result);
telnet.IsConnected(function (result) {
if (!result) {
document.getElementById("hostname").disabled = false;
document.getElementById("port").disabled = false;
document.getElementById("codepage").disabled = false;
document.getElementById("login").disabled = false;
document.getElementById("hostname").focus();
}
});
});
}
}
}
window.onunload = function () {
if (telnet.Disconnect) {
telnet.Disconnect();
}
}
</script>
</head>
<body>
<form onsubmit="return false;">
Ö÷»ú£º<input type="text" id="hostname" />
¶Ë¿Ú£º<input type="text" id="port" value="23" />
±àÂ룺<select id="codepage">
<option value="936" selected="selected">gb2312</option>
<option value="950">big5</option>
<option value="54936">GB18030</option>
<option value="65001">utf-8</option>
<option value="20127">us-ascii</option>
</select>
<input type="submit" id="login" value="怬" />
</form>
<br />
<textarea id="content" style="width: 484px; height: 304px" readonly="readonly"></textarea>
<br />
<input type="text" id="command" style="width: 484px; height: 16px" />
</body>
</html>
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.