ipconfig.html
2.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src="/static/js/ipvalidate.js"></script>
<script>
function validateForm() {
var ipAddress = document.getElementById("new_ip").value;
var netmask = document.getElementById("new_mask").value;
var router = document.getElementById("router_ip").value;
var dhcp_check = document.getElementById("dhcp").checked
if (dhcp_check)
{
return true
}
// Check if the IP address and netmask are valid
if (!isValidIpAddress(ipAddress)) {
alert("Invalid IP address");
return false;
}
if (!isValidNetmask(netmask)) {
alert("Invalid netmask");
return false;
}
if (!isValidIpAddress(router)) {
alert("Invalid router address");
return false;
}
return true;
}
</script>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
}
form {
display: flex;
flex-direction: column;
margin:50px auto
}
div p {
font-size: 24px;
#font-weight: bold;
display: block;
margin: 20px auto;
}
input[type="text"], textarea {
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
font-size: 16px;
}
input[type="submit"] {
padding: 10px 20px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 5px;
font-size: 16px;
cursor: pointer;
display: block;
margin: 0 auto;
}
label, input, textarea {
margin-bottom: 10px;
}
label.remark-label {
font-size: 14px;
color: #999;
}
</style>
<title> </title>
</head>
<body>
<div >
<p> Network Configure</p>
<form action="/ip_config" method="post" onsubmit="return validateForm()">
IP Address: <input type="text" id="new_ip" name="new_ip"><label class="remark-label">For Example:192.168.10.10</label><br>
Network Mask: <input type="text" id="new_mask" name="new_mask"><label class="remark-label">For Example:255.255.255.0</label><br>
Default GateWay: <input type="text" id="router_ip" name="router_ip"><label class="remark-label">For Example:192.168.10.1</label><br>
<label for="dhcp">Enable DHCP:
<input type="checkbox" name="dhcp" id="dhcp"></label><br>
<div style="margin:50px auto;width:200px;">
<input type="submit" value="Submit">
</div>
</form>
</div>
</body>
</html>