87,997
社区成员




<%@ page language="java" contentType="text/html; charset=utf-8"%>
<%@ page import="java.io.*"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>UE2020 Web Server Interface</title>
<meta name="keywords" content="UP2020 Industrial equipment control" />
<meta name="description" content="UP2020 Industrial equipment control" />
<link rel="stylesheet" type="text/css" href="vendor/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="fonts/font-awesome-4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="fonts/iconic/css/material-design-iconic-font.min.css">
<link rel="stylesheet" type="text/css" href="css/util.css">
<link rel="stylesheet" type="text/css" href="css/Intf.css">
</head>
<body>
<div class="top">
<font color="orange" size="5">
PSBC2020
</font>
</div>
<form>
<div class="box3">
<table class="tb">
<tr>
<th> </th>
<th>LED</th>
<th>IOA</th>
<th>Description</th>
</tr>
<tr>
<th>CH1</th>
<td> <select id="LED1" class="CD" onchange="check()">
<option value="0"> </option>
<option value="1">RGDM1</option>
<option value="2" >RGDM2</option>
</select></td>
<td><select id="IOA1" class="CD" onchange="check()">
<option value="0"> </option>
<option value="1">101700</option>
<option value="2" >102450</option>
</select> </td>
<td></td>
</tr>
<tr>
<th>CH2</th>
<td> <select id="LED2" class="CD" onchange="check()">
<option value="0"> </option>
<option value="1">RGDM1</option>
<option value="2" >RGDM2</option>
</select></td>
<td> <select id="IOA2" class="CD" onchange="check()">
<option value="0"> </option>
<option value="1">101700</option>
<option value="2" >102450</option>
</select> </td>
<td></td>
</tr>
<tr>
<th>CH3</th>
<td> <select id="LED3" class="CD" onchange="check()">
<option value="0"> </option>
<option value="1">RGDM1</option>
<option value="2" >RGDM2</option>
</select></td>
<td><select id="IOA3" class="CD" onchange="check()">
<option value="0"> </option>
<option value="1">101700</option>
<option value="2" >102450</option>
</select> </td>
<td></td>
</tr>
<tr>
<th>CH4</th>
<td> <select id="LED4" class="CD" onchange="check()">
<option value="0"> </option>
<option value="1">RGDM1</option>
<option value="2" >RGDM2</option>
</select></td>
<td><select id="IOA4" class="CD" onchange="check()">
<option value="0"> </option>
<option value="1">101700</option>
<option value="2" >102450</option>
</select> </td>
<td></td>
</tr>
</table>
<input type="reset" name="reset" class="check" value="Reset" style="width:100px;height:40px;float:left;"
onmouseover="this.style.backgroundColor = '#6f6f6f';" onmouseout="this.style.backgroundColor = '';"/>
<input type="submit" name="submit" class="check" value="Submit" style="width:100px;height:40px;float:right;"
onmouseover="this.style.backgroundColor = '#6f6f6f';" onmouseout="this.style.backgroundColor = '';"/>
</div>
</form>
</body>
<script type="text/javascript">
function check() {
var LED1 = document.getElementById("LED1").value;
var LED2 = document.getElementById("LED2").value;
var LED3 = document.getElementById("LED3").value;
var LED4 = document.getElementById("LED4").value;
var IOA1 = document.getElementById("IOA1").value;
var IOA2 = document.getElementById("IOA2").value;
var IOA3 = document.getElementById("IOA3").value;
var IOA4 = document.getElementById("IOA4").value;
if (LED1 === LED2 || LED1 === LED3 || LED1 === LED4 || LED2 === LED3 || LED2 === LED4 || LED3 === LED4) {
if (IOA1 === IOA2 || IOA1 === IOA3 || IOA1 === IOA4 || IOA2 === IOA3 || IOA2 === IOA4 || IOA3 === IOA4) {
alert("There is no same input value for diffrent channel! ");
}
}
}
</script>
<script src="vendor/jquery/jquery-3.2.1.min.js"></script>
<script src="js/main.js"></script>
</html>
let leds = $("select[id^=LED]")
let ioas = $("select[id^=IOA]")
function check() {
let arr1 = []
leds.each(function(i) {
const val = $(this).val()
const val1 = ioas[i].value
if (val > 0 && val1 > 0) {
arr1.push(val+ '-'+val1)
}
})
let arr2 = Array.from(new Set(arr1))
if (arr1.length !== arr2.length) {
alert('error')
}
}