budda555,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
</style>
</head>
<body>
<select class="abc">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
<select class="abc" multiple="multiple" size="5">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
<select class="abc" multiple="multiple" size="5">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
<script>
(function(){
const selects = document.querySelectorAll('select.abc');
let selected = JSON.parse(localStorage.selected || "[]");
[...selects].forEach((select, i) => {
select.onchange = function() {
let {selectedOptions} = select;
selectedOptions = [...selectedOptions].map(({index})=> index);
selected[i] = selectedOptions;
localStorage.selected = JSON.stringify(selected)
}
const selectedOptions = selected[i]||[];
[...select.children].forEach((option, i) => option.selected = selectedOptions.includes(i))
})
})()
</script>
</body>
</html>