<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>

<body>
<div id="sw">
<input type="range" id="num" min="1" max="10" step="1" value="3" onchange="aa()">
<input type="range" id="num1" min="1" max="10" step="1" value="3" onchange="aa()">
</div>
<div id="tip">

</div>
<button onclick="aa()">按钮</button>
</body>

</html>
<script>
var d = document.getElementById('num1')
d.onchange = function () {
console.log(d.value)
}


function aa() {
var a = document.getElementById('num')
var b = document.getElementById('tip')
var c = ''
switch (a.value) {
case "1":
c = "今天天气很好"
console.log("今天天气很好")
break;
case "2":
c = "明天天气很好"
console.log("明天天气很好")
break;
default:
c = "????"
console.log("????")
break;

}
b.innerText = c



}
</script>