123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- <HTML>
- <HEAD><TITLE>動態下拉式選單 (二階層):</Title></Head>
- <script type="text/javascript" src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
- <FORM Name="myForm" action="{{ url_for('Inquire_from') }}" method="POST">
- 第一個下拉式選單名稱為 color
- :
- <select name="Test1" OnChange="Buildkey(this.selectedIndex);">
- <tr>
- <option value="" selected></option>
- {% for i1 in labels1 %}
- <option>{{i1}}</option>
- {% endfor %}
- </tr>
- </select>
- <BR>
- 第二個下拉式選單名稱為 fruit
- :
- <select name="Test2" OnChange="Buildkey1(this.selectedIndex);">
- <tr>
- <option value="" selected></option>
- {% for i1 in labels2 %}
- <option>{{i1}}</option>
- {% endfor %}
- </tr>
- </select>
- <select name="Test3" OnChange="Buildkey2(this.selectedIndex);">
- <tr>
- <option value="" selected></option>
- {% for i1 in labels3 %}
- <option>{{i1}}</option>
- {% endfor %}
- </tr>
- </select>
- <select name="Test4">
- <tr>
- <option value="" selected></option>
- {% for i1 in labels4 %}
- <option>{{i1}}</option>
- {% endfor %}
- </tr>
- </select>
-
- <button type='submit'>Submit</button>
- </Form>
- </Body>
- </Html>
- <SCRIPT Language="JavaScript">
- key=new Array();
- var y = 39;
- var z = 40;
- key[0]=['','1','11','111'];
- key[1]=['','清洗桶組立','發酵桶組立','乾燥桶組立'];
- key[2]=['','3',y,z];
- key1=new Array();
- key1[0]=['','4','44','444'];
- key1[1]=['','三通閥A組立','三通閥B組立','三通閥C組立'];
- key1[2]=['',"6","66","666"];
- key2=new Array();
- key2[0]=['','M6x5止付螺絲','M4x12螺絲','M4螺帽'];
- key2[1]=['','8','88','888'];
- key2[2]=['',"9","99","999"];
- function Buildkey(num)
- {
- document.myForm.Test2.selectedIndex=0;
- for(ctr=0;ctr<key[num].length;ctr++){
- document.myForm.Test2.options[ctr]=new Option(key[num][ctr],key[num][ctr]);
- }
- document.myForm.Test2.length=key[num].length;
- }
- function Buildkey1(num)
- {
- document.myForm.Test3.selectedIndex=0;
- for(ctr=0;ctr<key1[num].length;ctr++){
- document.myForm.Test3.options[ctr]=new Option(key1[num][ctr],key1[num][ctr]);
- }
- document.myForm.Test3.length=key1[num].length;
- }
- function Buildkey2(num)
- {
- document.myForm.Test4.selectedIndex=0;
- for(ctr=0;ctr<key2[num].length;ctr++){
- document.myForm.Test4.options[ctr]=new Option(key2[num][ctr],key2[num][ctr]);
- }
- document.myForm.Test4.length=key2[num].length;
- }
- </Script>
|