demo.html
1.12 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
<div class="encrypt-form">
<div>
<label for="encryptInput">加密前的字符:</label>
<input id="encryptInput1" value="encrypt" />
</div>
<div>
<label for="encryptInput">加密后的字符:</label>
<input readonly="readonly" id="encryptInput2" value="" />
</div>
<a href="javascript:;" onclick="encrypt()">点击加密</a>
</div>
<style>
.encrypt-form {
margin: 10px;
}
.encrypt-form > div {
margin-bottom: 10px;
}
label, input {
display: inline-block;
height: 24px;
line-height: 24px;
vertical-align: middle;
}
input {
padding-left: 7px;
margin: 0;
border: 1px solid #ccc;
outline: none;
}
a {
display: block;
color: #108ee9;
padding-left: 105px;
text-decoration: underline;
}
</style>
<script>
function encrypt() {
var encryptInput1 = document.getElementById("encryptInput1");
var encryptInput2 = document.getElementById("encryptInput2");
var encryptStr = encryptInput1.value;
encryptInput2.value = "";
Mobile_NS.encrypt(encryptStr, function (result) {
encryptInput2.value = result;
});
}
</script>