本帖最后由 maiko2010 于 2010-03-23 21:43:39 编辑

解决方案 »

  1.   


    <!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=utf-8" />
    <title></title>
    <script>
    <!-- 
        var onecount;
        onecount=0;
        subcat = new Array();
        subcat[0] = new Array("CPU","产品");
        subcat[1] = new Array("主板","产品");
        subcat[2] = new Array("内存","产品");
        subcat[3] = new Array("硬盘","产品");
        subcat[4] = new Array("显示卡","产品");
        subcat[5] = new Array("周边配件","产品");
        
        subcat[6] = new Array("Javascript","程式");
        subcat[7] = new Array("CSS","程式");
        subcat[8] = new Array("Flash","程式");
        subcat[9] = new Array("ASP","程式");
        subcat[10] = new Array("HTML","程式");onecount=11;function changelocation(locationid) 

      document.myform.sType.length = 0; 
     var locationid=locationid; 
      var i; 
      document.myform.sType.options[0] = new Option('==== 请 选 择 ====',''); 
      for (i=0;i < onecount; i++) 
      { 
      if (subcat[i][1] == locationid) 
      { 
      document.myform.sType.options[document.myform.sType.length] = new Option(subcat[i][0], subcat[i][2]); 
      } 
      }
      doit()

    function doit(){
      var f  = document.myform
      document.getElementById("a").style.display = (f.sType.options[f.sType.selectedIndex].text=="硬盘" && f.sPlace.options[f.sPlace.selectedIndex].text=="产品")? "block":"none"
    }
    //--> 
    </script>
    </head><body>
    <form method="post" name="myform">
    <table border="0" cellpadding="0" align="center">
        <tr>
            <td>日  期:</td>
            <td><input type="text" value=""/></td>
        </tr>    <tr>
            <td>选择产品:</td>
            <td><select name="sPlace" id="" class="borderoption" onChange="changelocation(document.myform.sPlace.options[document.myform.sPlace.selectedIndex].value);">
                    <option value="">==== 请 选 择 ====</option>
                    <option value="产品">产品</option>
                    <option value="程式">程式</option>
            </select></td>
        </tr>    <tr>
            <td>产品内容:</td>
            <td>
                <select name="sType" onchange="doit()">
                    <option value="">==== 请 选 择 ====</option>
                </select>
            </td>
        </tr>    <tr>
            <td colspan="2"><div id="a" style="display:none;">
                产品1:&nbsp;<input id="input1" name="input1" type="text" value=""><br />
                产品2:&nbsp;<input id="input2" name="input2" type="text" value=""><br />
                产品3:&nbsp;<input id="input3" name="input3" type="text" value="">
                            </div>
            </td>
        </tr>    <tr>
            <td colspan="2" align="center">
                <input type="button" value="送出" id="myButton"/>
                <input type="reset" value="重做">
            </td>
        </tr>
    </table>
    </form>
    </body>
    </html>