Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/458.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
javascript组合框填充第二个组合错误_Javascript_Php - Fatal编程技术网

javascript组合框填充第二个组合错误

javascript组合框填充第二个组合错误,javascript,php,Javascript,Php,我为我的工作写了一个租赁检查页面。所有选定的 除了与一个以上的人一起工作以外的任何事情。比如卧室1,浴室1,壁炉1 与所有其他选择一样,工作正常。但是当卧室2,3,4,5, 选择浴室2、3、4、5等,它们根本不工作。我有一个解决办法,只需点击第一个,然后第二个等使用它 我已经在底部包含了卧房.items.php文件 提前感谢您的帮助 <script type="text/javascript"> function fillSecondCombo() { var combo1 =

我为我的工作写了一个租赁检查页面。所有选定的 除了与一个以上的人一起工作以外的任何事情。比如卧室1,浴室1,壁炉1 与所有其他选择一样,工作正常。但是当卧室2,3,4,5, 选择浴室2、3、4、5等,它们根本不工作。我有一个解决办法,只需点击第一个,然后第二个等使用它

我已经在底部包含了卧房.items.php文件

提前感谢您的帮助

<script type="text/javascript">
function fillSecondCombo()
{
   var combo1 = document.getElementById('Combobox1');
   var combo2 = document.getElementById('Combobox2');
   var selected = combo1.options[combo1.options.selectedIndex].value;
   if (selected == "attic")
   {
    <?php include_once "item.lists/attic.item.php"; ?>
   }
   else
   if (selected == "basement")
   {
    <?php include_once "item.lists/basement.item.php"; ?>
   }
   else
   if (selected == "bathroom1")
   {
    <?php include_once "item.lists/bathroom.items.php"; ?>
   }
   else
   if (selected == "bathroom2")
   {
    <?php include_once "item.lists/bathroom.items.php"; ?>
   }
   else
   if (selected == "bathroom3")
   {
    <?php include_once "item.lists/bathroom.items.php"; ?>
   }
   else
   if (selected == "bathroom4")
   {
    <?php include_once "item.lists/bathroom.items.php"; ?>
   }
   else
   if (selected == "bathroom5")
   {
    <?php include_once "item.lists/bathroom.items.php"; ?>
   }
   else
   if (selected == "bedroom1")
   {
    <?php include_once "item.lists/bedroom.items.php"; ?>
   }
   else
   if (selected == "bedroom2")
   {
    <?php include_once "item.lists/bedroom.items.php"; ?>
   }
   else
   if (selected == "bedroom3")
   {
    <?php include_once "item.lists/bedroom.items.php"; ?>
   }
   else
   if (selected == "bedroom4")
   {
    <?php include_once "item.lists/bedroom.items.php"; ?>
   }
   else
   if (selected == "bedroom5")
   {
    <?php include_once "item.lists/bedroom.items.php"; ?>
   }
   else
   if (selected == "cooling")
   {
    <?php include_once "item.lists/cooling.item.php"; ?>
   }
   else
   if (selected == "diningroom")
   {
    <?php include_once "item.lists/diningroom.item.php"; ?>
   }
   else
   if (selected == "electric")
   {
    <?php include_once "item.lists/electric.item.php"; ?>
   }
   else
   if (selected == "water")
   {
    <?php include_once "item.lists/water.item.php"; ?>
   }
   else
    if (selected == "gas")
   {
    <?php include_once "item.lists/gas.item.php"; ?>
   }
   else
   if (selected == "exterior")
   {
    <?php include_once "item.lists/exterior.item.php"; ?>
   }
   else
   if (selected == "foundation")
   {
    <?php include_once "item.lists/foundation.item.php"; ?>
   }
   else
   if (selected == "garage")
   {
    <?php include_once "item.lists/garage.item.php"; ?>
   }
   else
   if (selected == "heating")
   {
    <?php include_once "item.lists/heating.item.php"; ?>
   }
   else
   if (selected == "interior")
   {
    <?php include_once "item.lists/interior.item.php"; ?>
   }
   else
   if (selected == "kitchen")
   {
    <?php include_once "item.lists/kitchen.item.php"; ?>
   }
   else
   if (selected == "laundry")
   {
    <?php include_once "item.lists/laundry.item.php"; ?>
   }
   else
   if (selected == "roof")
   {
    <?php include_once "item.lists/roof.item.php"; ?>
   }
   else
   if (selected == "waterhtr")
   {
    <?php include_once "item.lists/waterhtr.item.php"; ?>
   }
   else
   if (selected == "livingroom")
   {
    <?php include_once "item.lists/livingroom.item.php"; ?>
   }
   else
   if (selected == "fireplace1")
   {
    <?php include_once "item.lists/fireplace.items.php"; ?>
   }
   else
   if (selected == "fireplace2")
   {
    <?php include_once "item.lists/fireplace.items.php"; ?>
   }
   else
   if (selected == "fireplace3")
   {
    <?php include_once "item.lists/fireplace.items.php"; ?>
   }
   else
   if (selected == "fireplace4")
   {
    <?php include_once "item.lists/fireplace.items.php"; ?>
   }
   else
   if (selected == "fireplace5")
   {
    <?php include_once "item.lists/fireplace.items.php"; ?>
   }
   else
   if (selected == "fireplace10")
   {
    <?php include_once "item.lists/fireplace.items.php"; ?>
   }
   else
   if (selected == "poolspa")
   {
    <?php include_once "item.lists/poolspa.item.php"; ?>
   }
   else
   if (selected == "other")
   {
    <?php include_once "item.lists/other.item.php"; ?>
   }
   else
   {
    combo2.options.length = 0;
   }
}
</script>
</head>
<body>
<div id="space"><br></div>
<div id="container">

<button id="AdvancedButton1" type="button" style="position:absolute;left:19px;top:119px;width:137px;height:44px;z-index:12;" onclick="window.location='main.php'" name="Your Account" value="">
<div style="text-align:center"><span style="color:#FFFFFF;font-family:Arial;font-size:16px"><b>Main Menu</b></span></div>
</button>
<button id="AdvancedButton2" type="button" style="position:absolute;left:176px;top:119px;width:124px;height:44px;z-index:13;" onclick="window.location='logout.php'" name="Logout" value="">
<div style="text-align:center"><span style="color:#FFFFFF;font-family:Arial;font-size:16px"><b>Logout</b></span></div>
</button>
<div id="wb_Form1" style="position:absolute;left:20px;top:209px;width:302px;height:574px;z-index:14;">
<form name="Form1" method="post" action="make.all.php" enctype="multipart/form-data" id="Form1" onsubmit="return ValidateForm1(this)">
<textarea name="a4" id="TextArea1" style="position:absolute;left:1px;top:275px;width:279px;height:143px;z-index:0;" rows="7" cols="32" tabindex="4"></textarea>
<div id="wb_Text5" style="position:absolute;left:4px;top:249px;width:152px;height:16px;z-index:1;text-align:left;">
<span style="color:#000000;font-family:Arial;font-size:13px;">Notes: 300 Chars Max.</span></div>
<div id="wb_Text4" style="position:absolute;left:0px;top:164px;width:170px;height:16px;z-index:2;text-align:left;">
<span style="color:#000000;font-family:Arial;font-size:13px;">Passed-Needs Repare-N/A:</span></div>
<select name="a2" size="1" id="Combobox2" style="position:absolute;left:0px;top:109px;width:280px;height:43px;z-index:3;" tabindex="2">
</select>
<div id="wb_Text3" style="position:absolute;left:4px;top:85px;width:140px;height:16px;z-index:4;text-align:left;">
<span style="color:#000000;font-family:Arial;font-size:13px;">Item Being Inspected:</span></div>
<select name="a1" size="1" id="Combobox1" onchange="fillSecondCombo();return false;" style="position:absolute;left:1px;top:32px;width:279px;height:43px;z-index:5;" tabindex="1">
<option value="<?php include "$dirPath/all.areas.php"; ?>"></option>
</select>
<div id="wb_Text2" style="position:absolute;left:4px;top:0px;width:142px;height:16px;z-index:6;text-align:left;">
<span style="color:#000000;font-family:Arial;font-size:13px;">Area Being Inspected:</span></div>
<div id="wb_Text1" style="position:absolute;left:4px;top:436px;width:59px;height:16px;z-index:7;text-align:left;">
<span style="color:#000000;font-family:Arial;font-size:13px;">Photo:</span></div>
<input type="file" id="FileUpload1" style="position:absolute;left:2px;top:452px;width:279px;height:41px;line-height:41px;z-index:8;" name="userfile[]" tabindex="5">
<input type="submit" id="Button1" name="" value="Submit" style="position:absolute;left:44px;top:513px;width:102px;height:30px;z-index:9;" tabindex="6">
<select name="a3" size="1" id="Combobox3" style="position:absolute;left:0px;top:188px;width:280px;height:43px;z-index:10;" tabindex="3">
<option selected value="Passed">Passed</option>
<option value="Needs Repair">Needs Repair</option>
<option value="N/A">N/A</option>
</select>
</form>
</div>
<div id="wb_TextArt1" style="position:absolute;left:18px;top:8px;width:285px;height:100px;z-index:15;">
<img src="images/img0018.png" id="TextArt1" alt="Enter Inspection Data" title="Enter Inspection Data" style="width:285px;height:100px;"></div>
</div>
</body>
</html>

为什么无缘无故地陷入低谷?我还需要补充什么吗?我不知道该怎么解释。我已经四处寻找了一段时间,但是他们不太符合这个代码。嘿@bpross。你的问题有点让人困惑。很难说你到底想达到什么目的。当选择任何组合框1项时,它都会填充第二个组合框。除卧室2、3、4、5和浴室2、3、4、5和壁炉2、3、4、5卧室1、浴室1和壁炉1以及所有其他非卧室、浴室外,所有工作均填充第二个组合框。如果我选择卧室2,3,4,5浴室2,3,4,5和壁炉2,3,4,5中的任何一个,它们不会填充第二个组合框。我看不出为什么不可以。请你编辑你的问题,向我们展示你的那些
的HTML?完成了。所有选定的项目都可以工作,但3个项目中有1个以上的项目除外。
combo2.options.length = 9;
combo2.options[0] = new Option("Electrical Wall Plugs", "Electrical Wall Plugs");
combo2.options[1] = new Option("Walls and Ceiling", "Walls and Ceiling");
combo2.options[2] = new Option("Floor Covering", "Floor Covering");
combo2.options[3] = new Option("Windows (curtains, blinds, etc...)", "Windows (curtains, blinds, etc...)");
combo2.options[4] = new Option("Doors", "Doors");
combo2.options[5] = new Option("Lighting/Light Fixtures", "Light Fixtures");
combo2.options[6] = new Option("Closet(s)", "Closet(s)");
combo2.options[7] = new Option("Smoke Detector(s)", "Smoke Detector(s)");
combo2.options[8] = new Option("Heating/Cooling", "Heating/Cooling");