---
title: "获得select的option值"
author: "wangyu"
date: "2009-04-27T09:38:59Z"
tags: []
slug: "select-option"
draft: false
lastmod: "2009-04-27T09:38:59Z"
id: 375324
url: "https://wangyu.iteye.com/blog/375324"
---

```html

<select name="opt" onchange="test()"> 
<option value="1">111 
<option value="2">222 
<option value="3">333 
<option value="4">444 
<option value="5">555 
<option value="6">666 
<option value="7">777 
</select> 

<SCRIPT LANGUAGE="JavaScript">
<!--
function test(){
	alert(document.all.opt.options[document.all.opt.selectedindex].innerText);
	alert(document.all.opt.options[document.all.opt.selectedindex].value );
	}
//-->
</SCRIPT>

```