<label for="city" style='color:#FF0000;'>地市:</label><select id="city" data-dojo-type="dijit/form/Select" data-dojo-props='style:"width:250px;"'> <option value="0">全部</option> <option value="1">武漢市</option> <option value="2">黃石市</option> <option value="3">十堰市</option> <option value="4">荊州市</option> <option value="5">宜昌市</option> <option value="6">襄陽市</option> <option value="7">鄂州市</option> <option value="8">荊門市</option> <option value="9">黃岡市</option> <option value="10">鹹寧市</option> <option value="11">隨州市</option> <option value="12">孝感市</option></select>
<label for="cityCom" style='color:#00FF00;'>地市:</label><select id="cityCom" data-dojo-type="dijit/form/ComboBox" data-dojo-props='style:"width:250px;"'> <option value="0">全部</option> <option value="1">武漢市</option> <option value="2">黃石市</option> <option value="3">十堰市</option> <option value="4">荊州市</option> <option value="5">宜昌市</option> <option value="6">襄陽市</option> <option value="7">鄂州市</option> <option value="8">荊門市</option> <option value="9">黃岡市</option> <option value="10">鹹寧市</option> <option value="11">隨州市</option> <option value="12">孝感市</option></select>
<label for="cityFil" style='color:#0000FF;'>地市:</label><select id="cityFil" data-dojo-type="dijit/form/FilteringSelect" data-dojo-props='style:"width:250px;"'> <option value="0">全部</option> <option value="1">武漢市</option> <option value="2">黃石市</option> <option value="3">十堰市</option> <option value="4">荊州市</option> <option value="5">宜昌市</option> <option value="6">襄陽市</option> <option value="7">鄂州市</option> <option value="8">荊門市</option> <option value="9">黃岡市</option> <option value="10">鹹寧市</option> <option value="11">隨州市</option> <option value="12">孝感市</option></select>
<!DOCTYPE html><!--To change this license header, choose License Headers in Project Properties.To change this template file, choose Tools | Templatesand open the template in the editor.--><html> <head> <title>FilteringSelect</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width"> <link rel="stylesheet" href="../script/dojoroot/dijit/themes/claro/claro.css"/> <script type="text/javascript" src="../script/dojoroot/dojo/dojo.js" data-dojo-config="isDebug: true, parseOnLoad: true"></script> <style type="text/css"> body{ width:100%; height:100%; font-size:12px; } #tab{ width:40%; height:60px; font-weight:bold; } </style> <script type="text/javascript"> dojo.require("dijit.form.DateTextBox"); </script> </head> <body class="claro" role="main"> <table id="tab"> <tr> <td> <label for="city" style='color:#FF0000;'>地市:</label> <select id="city" data-dojo-type="dijit/form/Select" data-dojo-props='style:"width:250px;"'> <option value="0">全部</option> <option value="1">武漢市</option> <option value="2">黃石市</option> <option value="3">十堰市</option> <option value="4">荊州市</option> <option value="5">宜昌市</option> <option value="6">襄陽市</option> <option value="7">鄂州市</option> <option value="8">荊門市</option> <option value="9">黃岡市</option> <option value="10">鹹寧市</option> <option value="11">隨州市</option> <option value="12">孝感市</option> </select> </td> <td> <button type="button" data-dojo-type="dijit/form/Button" data-dojo-props='style:"width:100px;"'>查詢 <script type="dojo/on" data-dojo-event="click"> //擷取option中的value值 var city = dijit.byId('city').get('value'); //擷取option中的value值的描述 var cityValue = dijit.byId('city').get('displayedValue'); //列印option中的value值 alert(city); //列印option中的value值的描述 alert(cityValue); </script> </button> </td> </tr> <tr> <td> <label for="cityCom" style='color:#00FF00;'>地市:</label> <select id="cityCom" data-dojo-type="dijit/form/ComboBox" data-dojo-props='style:"width:250px;"'> <option value="0">全部</option> <option value="1">武漢市</option> <option value="2">黃石市</option> <option value="3">十堰市</option> <option value="4">荊州市</option> <option value="5">宜昌市</option> <option value="6">襄陽市</option> <option value="7">鄂州市</option> <option value="8">荊門市</option> <option value="9">黃岡市</option> <option value="10">鹹寧市</option> <option value="11">隨州市</option> <option value="12">孝感市</option> </select> </td> <td> <button type="button" data-dojo-type="dijit/form/Button" data-dojo-props='style:"width:100px;"'>查詢 <script type="dojo/on" data-dojo-event="click"> //擷取option中的value值 var cityC = dijit.byId('cityCom').get('value'); //擷取option中的value值的描述 var cityValueC = dijit.byId('cityCom').get('displayedValue'); //列印option中的value值 alert(cityC); //列印option中的value值的描述 alert(cityValueC); </script> </button> </td> </tr> <tr> <td> <label for="cityFil" style='color:#0000FF;'>地市:</label> <select id="cityFil" data-dojo-type="dijit/form/FilteringSelect" data-dojo-props='style:"width:250px;"'> <option value="0">全部</option> <option value="1">武漢市</option> <option value="2">黃石市</option> <option value="3">十堰市</option> <option value="4">荊州市</option> <option value="5">宜昌市</option> <option value="6">襄陽市</option> <option value="7">鄂州市</option> <option value="8">荊門市</option> <option value="9">黃岡市</option> <option value="10">鹹寧市</option> <option value="11">隨州市</option> <option value="12">孝感市</option> </select> </td> <td> <button type="button" data-dojo-type="dijit/form/Button" data-dojo-props='style:"width:100px;"'>查詢 <script type="dojo/on" data-dojo-event="click"> //擷取option中的value值 var cityF = dijit.byId('cityFil').get('value'); //擷取option中的value值的描述 var cityValueF = dijit.byId('cityFil').get('displayedValue'); //列印option中的value值 alert(cityF); //列印option中的value值的描述 alert(cityValueF); </script> </button> </td> </tr> </table> </body></html>