Select form 属性
 Select 对象
 Select 对象
定义和用法
form 属性可返回对包含该下拉列表的表单元素的引用。
该属性返回 form 对象。
语法
selectObject.form
浏览器支持





所有主要浏览器都支持 form 属性
实例
实例
显示包含下拉列表的表单id:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>代码学院(codexy.cn)</title>
<script>
function displayResult(){
var x=document.getElementById("mySelect").form.id;
alert(x);
}
</script>
</head>
<body>
<form id="form1">
选择你最喜欢的水果:
<select id="mySelect">
<option>Apple</option>
<option>Orange</option>
<option>Pineapple</option>
<option>Banana</option>
</select>
</form>
<button type="button" onclick="displayResult()">显示所属的表单ID</button>
    
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>代码学院(codexy.cn)</title>
<script>
function displayResult(){
var x=document.getElementById("mySelect").form.id;
alert(x);
}
</script>
</head>
<body>
<form id="form1">
选择你最喜欢的水果:
<select id="mySelect">
<option>Apple</option>
<option>Orange</option>
<option>Pineapple</option>
<option>Banana</option>
</select>
</form>
<button type="button" onclick="displayResult()">显示所属的表单ID</button>
</body>
</html>
尝试一下 »
 Select 对象
 Select 对象			
						
			
 JavaScript 教程
JavaScript 教程 JavaScript 对象
JavaScript 对象 jQuery 教程
jQuery 教程 JSON 教程
JSON 教程 AngularJS 教程
AngularJS 教程 Angular 2 教程
Angular 2 教程 Vue.js 教程
Vue.js 教程 React 教程
React 教程 jQuery UI 教程
jQuery UI 教程 jQuery EasyUI 教程
jQuery EasyUI 教程 AJAX 教程
AJAX 教程 Highcharts 教程
Highcharts 教程 Google Maps API 教程
Google Maps API 教程 ES6 教程
ES6 教程 TypeScript教程
TypeScript教程 ES6 标准入门
ES6 标准入门