ipconfig.html 2.4 KB

    


<!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>