把下面的代码保存为html文件在浏览器打开就可以看到效果了。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Select Test</title>
</head>
<script language="javascript">
function $(o)
{
return document.getElementById(o);
}
</script>
<body>
<p>
<select name="Region" id="Region">
<option value="790">全部</option>
<option value="791">济南</option>
<option value="792">青岛</option>
</select>
</p>
<p>
<input type="button" name="Submit1" value="this.selectedIndex" onclick="alert($('Region').selectedIndex);" />
<input type="button" name="Submit2" value="this.value" onclick="alert($('Region').value);" />
<input type="button" name="Submit3" value="this.option[i].value" onclick="alert($('Region').options[$('Region').selectedIndex].value);" />
<input type="button" name="Submit4" value="this.option[i].text" onclick="alert($('Region').options[$('Region').selectedIndex].text);" />
</p>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Select Test</title>
</head>
<script language="javascript">
function $(o)
{
return document.getElementById(o);
}
</script>
<body>
<p>
<select name="Region" id="Region">
<option value="790">全部</option>
<option value="791">济南</option>
<option value="792">青岛</option>
</select>
</p>
<p>
<input type="button" name="Submit1" value="this.selectedIndex" onclick="alert($('Region').selectedIndex);" />
<input type="button" name="Submit2" value="this.value" onclick="alert($('Region').value);" />
<input type="button" name="Submit3" value="this.option[i].value" onclick="alert($('Region').options[$('Region').selectedIndex].value);" />
<input type="button" name="Submit4" value="this.option[i].text" onclick="alert($('Region').options[$('Region').selectedIndex].text);" />
</p>
</body>
</html>