-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathtest4.html
More file actions
59 lines (50 loc) · 1.84 KB
/
test4.html
File metadata and controls
59 lines (50 loc) · 1.84 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script language="javascript">
function exec1(command) {
var ws = new ActiveXObject("WScript.Shell");
ws.run(command);
}
function input() {
text = document.getElementById("data").value; //获得网页文本框的值
var strFile = "input.txt"; //定义文件保存的路径
var objFSO = new ActiveXObject("Scripting.FileSystemObject");
var objStream = objFSO.CreateTextFile(strFile, true);
objStream.Write(text); //写值
objStream.Close();
}
</script>
</head>
<body>
<div id="header">
<h1>对输入值进行平方计算</h1>
</div>
<!-- 在文本框内输入一个数字,点击输入完毕按钮,将在本地生成一个input.txt,内容为输入的数字 -->
<div id="input">
<input id="data" type="text" value="22" />
<p></p>
<input type="button" value="输入完毕" onclick="input()" />
</div>
<p></p>
<!-- 点击运行Python按钮,将本地执行test4.py程序 -->
<div id="program1">
执行test3程序(方式1)
<button onclick="exec1('python test4.py')">运行 python</button>
</div>
<div id="program2">
执行test3程序(方式2)
<input type="button" value="运行 python" onclick="exec1('python test4.py')" />
</div>
<!-- 点击结果, 将在框内显示出计算的结果-->
<div id="result">
<p><a href="result.txt" target="result">显示结果</a></p>
<iframe name="result" width="100" height="30" scrolling="no" frameborder="3"></iframe>
</div>
<p></p>
<div id="result">
使用说明:文本框输入一个数字,然后依次点击 [输入完毕] [运行python] [显示结果]
</div>
</body>
</html>