아래 그림과 같이 :
다음과 같이 코드 코드를 복사하십시오.
<!
<html xmlns = "http://www.w3.org/1999/xhtml">
<헤드>
<meta http-equiv = "content-type"content = "text /html; charset = utf-8" /> />
<title> 비 -타이틀 문서 </title>
<script type = "text/javaScript">
fuinction selchange () {
var sel = document.getElementById ( 'sel');
alert (sel.options [sel.selectex] .text); 텍스트);
경고 (sel.options [sel.selectex]. 값);
}
</스크립트>
</head>
<body>
<select id = "sel"onchange = "selchange ()">
<옵션 값 = "Zhangsan"> Zhang San </옵션>
<옵션 값 = "lisi"> li si </옵션>
<옵션 값 = "Wangwu"> Wang Wu </옵션>
</선택>
</body>
</html>