function ListDiameter(SelectValue) { addProduct.ddlDiameter.length = 0 addProduct.ddlLength.length = 0 //*** Insert null Default Value ***// var myOption = new Option('','') addProduct.ddlDiameter.options[addProduct.ddlDiameter.length]= myOption <? $intRows = 0; $strSQL = "SELECT DISTINCT (`diameter`) FROM `econ_match_product` WHERE `plate`='Z' AND COMMODITYID='$commodityid2' " ; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); $intRows = 0; while($objResult = mysql_fetch_array($objQuery)) { $intRows++; ?> x = <?=$intRows;?>; mySubList = new Array(); strGroup = <?=$objResult["plate"];?>; strValue = "<?=$objResult["diameter"];?>"; strItem = "<?=$objResult["diameter"];?>"; mySubList[x,0] = strItem; mySubList[x,1] = strGroup; mySubList[x,2] = strValue; if (mySubList[x,1] == SelectValue){ var myOption = new Option(mySubList[x,0], mySubList[x,2]) frmMain.ddlProvince.options[frmMain.ddlProvince.length]= myOption } <? } ?> } form สำหรับให้แสดงค่ะ <form name="addProduct" id="addProduct" method="get" action=""> <table border="1" width="100%"> <tr> <td width="40%">รูปภาพ</td> <td> <table border="1" width="100%"> <tr> <td align="right" width="30%"><b>Plating :</b></td> <td> <select name="plates" id="platesid" onChange = "ListDiameter(this.value)"> <option value=""></option> <?php include "connect.php"; $sql_plates = "SELECT DISTINCT (a.`plate`), b.`particular` " ."FROM `econ_match_product` a " ."INNER JOIN plates_ec b ON a.`plate` = b.`plateid` " ."WHERE `commodityid`='$commodityid2'"; echo "sql_plates = $sql_plates <br />"; $dbquery_plates=mysql_db_query($dbname,$sql_plates); while($result_plates=mysql_fetch_array($dbquery_plates)){ $plateid = $result_plates[plate]; $name = $result_plates[particular]; //echo"<h3> name_midi = $name_midi</h3>"; //echo"<h3> detail_midi = $detail_midi</h3>"; //$typeofbusinessid = $result[typeofbusinessid]; //if($name == $result[name_en]){ //เพื่อให้ แสดง $contryid ที่ส่งค่ามาให้ // echo"<h3> $id_midi </h3>"; ?> <option value="<?php echo $plateid ?>" ><?php echo $name?></option> <?php }//end while ?> </select> </td> </tr> <tr> <td><b>Diameter : </b></td> <td> <select id="ddlDiameter" name="ddlDiameter" style="width:120px" onChange = "ListLength(this.value)"> </select> </td> </tr> ******* โดยเมื่อทำการเลือกค่าจาก list ข้างต้นได้แล้วก็จะมีการทำงานส่วนอื่นตรงนี้ค่ะ แต่ตอนนี้ยังแก้ปัญหาเรื่อง dropdownlist ไม่ได้ </table> </td> </tr> </table> </form>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง