<html>
<body>
<input type="range" id="myRange" name="points">
<p>点击按钮显示或修改滑块控件 name 属性的值。</p>
<button onclick="display()">显示名称</button>
<button onclick="change()">修改名称</button>
<script>
function display() {
var x = document.getElementById("myRange").name;
alert("滑块控件名称为: " + x);
}
function change() {
var x = document.getElementById("myRange").name = "newRangeName";
alert ("名称修改为: " + x);
}
</script>
</body>
</html>