dojo中的下拉框

來源:互聯網
上載者:User

<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>


相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.