<!DOCTYPE html>
<html>
<body>
<select id="sample">
<option>Test 1</option>
<option>Test 2</option>
<option>Test 3</option>
<option>Test 4</option>
</select>
<button onclick="myTest()">Try it</button>
<p id="test"></p>
<script>
function myTest() {
var sampleValue = document.getElementById("sample").value;
document.getElementById("test").innerHTML = sampleValue;
}
</script>
</body>
</html>
感謝大大
回覆刪除